代码驿站移动版
频道导航
HTML/Xhtml
CSS
JavaScript
HTML5
PHP教程
ASP.NET
正则表达式
AJAX
ThinkPHP
Yii
MySQL
MariaDB
Oracle
MongoDB
Redis
DedeCMS
PHPCMS
帝国CMS
WordPress
Discuz
其它CMS
Zend Studio
Sublime
Notepad
Dreamweaver
Windows
Linux
Nginx
Apache
IIS
CentOS
Ubuntu
Debian
网站优化
工具资源
PHP源码
ASP.NET源码
其它源码
图标素材
按钮素材
字体素材
DedeCMS模板
帝国CMS模板
PHPCMS模板
WordPress模板
Discuz!模板
单页模板
开发软件下载
服务器软件下载
广告投放
联系我们
版权申明
软件编程
网页前端
移动开发
数据库
服务器
脚本语言
PHP代码
JAVA代码
Python代码
Android代码
当前位置:
主页
>
网页前端
>
JavaScript代码
>
颜色选择: ColorMatch 5K
时间:2020-10-16 12:44:25 | 栏目:
JavaScript代码
| 点击:次
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <meta name="generator" content="WebWerx 2.5"> <meta name="keywords" content="colormatch,5k,color picker,color schemes,match,matching,colors,colours,palette,web design,free,freeware,online"> <meta name="description" content="Online tool for picking matching color schemes. Made in less than 5.120 bytes of code."> <style> body {background-color:#E6E6E6; font:10px tahoma; margin:30px; margin-top:20px; color:#323232; } p {margin:0px; margin-bottom:4px; font:11px tahoma; line-height: 12px; } td {vertical-align:top;} h1 {font-size:12px; font-weight:bold margin:0px; margin-bottom:8px; } </style> </head> <body> <style>.s{border:inset 1;width:50}.s2{border:outset 1;width:19;height:19;background-color:#E6E6E6;position:absolute;left:1;top:1}.t{font:11px tahoma;color:#555555}.t2{font:bold 36px verdana}</style></head><script language="JavaScript">var mover=moveg=moveb=moveh=0;var hs=new Object();var rg=new Object();rg.r=rg.g=rg.b=0;function click(x,s){if(x<10){x=10};if(x>265){x=265}x-=10;eval("h"+s+".style").left=x+1;eval("rg."+s+"="+x);rg2hs(rg);ud("0",rg);sw.style.backgroundColor="rgb("+rg.r+","+rg.g+","+rg.b+")";dom();}function bclick(s){x=window.event.offsetX+eval("h"+s+".style.pixelLeft-1");click(x,s);}function sc(s){x=window.event.offsetX;click(x,s);}function movee(s){eval("move"+s+"=0")}function rc(x,m){if(x>m){return m}if(x<0){return 0}else{return x}}function rg2hs(rg){m=rg.r;if(rg.g<m){m=rg.g};if(rg.b<m){m=rg.b};v=rg.r;if(rg.g>v){v=rg.g};if(rg.b>v){v=rg.b};value=100*v/255;delta=v-m;if(v==0.0){hs.s=0}else{hs.s=100*delta/v};if(hs.s==0){hs.h=0}else{if(rg.r==v){hs.h=60.0*(rg.g-rg.b)/delta}else if(rg.g==v){hs.h=120.0+60.0*(rg.b-rg.r)/delta}else if(rg.b=v){hs.h=240.0+60.0*(rg.r-rg.g)/delta}if(hs.h<0.0){hs.h=hs.h+360.0}}hs.v=Math.round(value);hs.h=Math.round(hs.h);hs.s=Math.round(hs.s);return(true);}function rg2html(z){return "#"+d2h(z.r)+d2h(z.g)+d2h(z.b);}function d2h(d){hch="0123456789ABCDEF";a=d%16;b=(d-a)/16;return hch.charAt(b)+hch.charAt(a);}function c2r(d){k=window.event.srcElement.style.backgroundColor;j=(k.substr(4,k.indexOf(")")-4)).split(",");click(parseInt(j[0])+10,"r");click(parseInt(j[1])+10,"g");click(parseInt(j[2])+10,"b");}function h2r(hs){var rg=new Object();if(hs.s==0){rg.r=rg.g=rg.b=Math.round(hs.v*2.55);return rg;}hs.s=hs.s/100;hs.v=hs.v/100;hs.h/=60;i=Math.floor(hs.h);f=hs.h-i;p=hs.v*(1-hs.s);q=hs.v*(1-hs.s*f);t=hs.v*(1-hs.s*(1-f));switch(i){case 0:rg.r=hs.v;rg.g=t;rg.b=p;break;case 1:rg.r=q;rg.g=hs.v;rg.b=p;break;case 2:rg.r=p;rg.g=hs.v;rg.b=t;break;case 3:rg.r=p;rg.g=q;rg.b=hs.v;break;case 4:rg.r=t;rg.g=p;rg.b=hs.v;break;default:rg.r=hs.v;rg.g=p;rg.b=q;}rg.r=Math.round(rg.r*255);rg.g=Math.round(rg.g*255);rg.b=Math.round(rg.b*255);return rg;}function ps(x){document.write('<td><div style="width:53;height:53;background-color:rgb(0,0,0);cursor:hand" class=s id="sw'+x+'" onClick="c2r()" title="Click to promote to primary color"></div></td>');}function ph(x){document.write('<td><div class=t id="hc'+x+'">#000000</div></td>');}function ud(x,c){eval("sw"+x).style.backgroundColor="rgb("+c.r+","+c.g+","+c.b+")";eval("hc"+x).innerHTML=rg2html(c)}function pl(t,c,l){document.write('<div style="position:absolute;left:30;top:'+t+';background-color:black"><div class=s style="width:276;height:21;background-color:'+c+';filter:alpha(style=1,startx=360,finishx=0);" onMouseDown="move'+l+'=1;sc(\''+l+'\');" onMouseMove="if(move'+l+'==1){sc(\''+l+'\');}"></div><div class=s2 id=h'+l+' onMouseDown="move'+l+'=1;bclick(\''+l+'\');" onMouseUp="movee(\''+l+'\');" onMouseMove="if(move'+l+'==1){bclick(\''+l+'\');}"></div></div>')}function dom(){z=new Object();y=new Object();yx=new Object();y.s=hs.s;y.h=hs.h;if(hs.v>70){y.v=hs.v-30}else{y.v=hs.v+30};z=h2r(y);ud("1",z);if((hs.h>=0)&&(hs.h<30)){yx.h=y.h=hs.h+20;yx.s=y.s=hs.s;y.v=hs.v;if(hs.v>70){yx.v=hs.v-30}else{yx.v=hs.v+30}}if((hs.h>=30)&&(hs.h<60)){yx.h=y.h=hs.h+150;y.s=rc(hs.s-30,100);y.v=rc(hs.v-20,100);yx.s=rc(hs.s-70,100);yx.v=rc(hs.v+20,100);}if((hs.h>=60)&&(hs.h<180)){yx.h=y.h=hs.h-40;y.s=yx.s=hs.s;y.v=hs.v;if(hs.v>70){yx.v=hs.v-30}else{yx.v=hs.v+30}}if((hs.h>=180)&&(hs.h<220)){yx.h=hs.h-170;y.h=hs.h-160;yx.s=y.s=hs.s;y.v=hs.v;if(hs.v>70){yx.v=hs.v-30}else{yx.v=hs.v+30}}if((hs.h>=220)&&(hs.h<300)){yx.h=y.h=hs.h;yx.s=y.s=rc(hs.s-60,100);y.v=hs.v;if(hs.v>70){yx.v=hs.v-30}else{yx.v=hs.v+30}}if(hs.h>=300){if(hs.s>50){y.s=yx.s=hs.s-40}else{y.s=yx.s=hs.s+40}yx.h=y.h=(hs.h+20)%360;y.v=hs.v;if(hs.v>70){yx.v=hs.v-30}else{yx.v=hs.v+30}}z=h2r(y);ud("2",z);z=h2r(yx);ud("3",z);y.h=0;y.s=0;y.v=100-hs.v;z=h2r(y);ud("4",z);y.h=0;y.s=0;y.v=hs.v;z=h2r(y);ud("5",z);}</script><body onMouseUp="mover=moveg=moveb=0;" bgcolor=#E6E6E6 leftmargin=30 topmargin=30 class=t><div style="width:400"><span class=t2>ColorMatch 5K</span>This utility will help you select a matching 6-color palette for your website.Define a single color that you like. Matching colors will be calculated.Click a color in the palette to promote it to the primary color.<b>I like this color:6-color matching palette:</div><script>pl(170,"red","r");pl(200,"green","g");pl(230,"blue","b")</script><div class=s id=sw style="position:absolute;left:316;top:170;height:81;width:82;background-color:black;"></div><div style="position:absolute;left:20;top:290;"><table cellspacing=10 cellpadding=0><tr><script>ps(0);ps(1);ps(2);ps(3);ps(4);ps(5);</script></tr><tr><script>ph(0);ph(1);ph(2);ph(3);ph(4);ph(5);</script></tr></table></div> <div style="width:500px; top:420px; position:absolute;"> <h1>About this page</h1> <p>The color selector on this site was submitted as an entry for the Danish 5KB (5.120 bytes) web competition in 2001.</p> <p>Given the nature of the competition ?allowing only for 5.120 bytes to be used in total! ?I was not able to make it cross-browser compatible at the time. Despite the lack of compatibility beyond IE, the tool won the competition.</p> <p>A lot of enthusiastic people around the World have not only made it more compatible, but also added even more features. <a target="_blank" href="http://www.google.com/search?q=colormatch+5k">Google will guide you to them!</a></p> <p>If you for some reason want to get in touch with me, please use the contact form at my site <a target="_top" href="http://port80.biz">Port80.biz</a>. ?Best regards, Kim Jensen aka kim^lwx</p> </div> </body> </html>
[Ctrl+A 全选 注:
引入外部Js需再刷新一下页面才能执行
]
您可能感兴趣的文章:
JavaScript常见事件处理程序实例总结
url传递的参数值中包含&时,url自动截断问题的解决方法
Javascript的匿名函数小结
javascript上下左右定时滚动插件
Javascript别踩白块儿(钢琴块儿)小游戏实现代码
相关文章
11-08
兼容浏览器的js事件绑定函数(详解)
11-27
Javascript实例教程(19) 使用HoTMetal(2)
11-23
Webpack中loader打包各种文件的方法实例
10-05
javascript判断图片是否加载完成的方法推荐
11-22
在javascript中执行任意html代码的方法示例解读
JQuery
VUE
AngularJS
MSSql
MySQL
MongoDB
Redis
Linux
Tomcat
Nginx
网站首页
广告投放
联系我们
版权申明
联系站长