📄 5color.htm
字号:
else if(CL3[2]<0)
CL3[2]=0;
R1.value = CL3[0];
G1.value = CL3[1];
B1.value = CL3[2];
if(Ev){
xColor1.style.background = 'rgb('+CL3[0]+','+CL3[1]+','+CL3[2]+')';
}
xColor2.style.background = 'rgb('+CL3[0]+','+CL3[1]+','+CL3[2]+')';
Color1HTML.value = RGBtoHTML(CL3[0],CL3[1],CL3[2]);
WinReturnValue.value = Color1HTML.value;
delete CL3,H,S,V,eY,Ev;
}
//==[颜色条]
function drawColorLine(){
var CX = 50;
var CY = 180;
var ColorMainLayer = '';
var t=new Array()
var SevenColor = new Array('255,0,0','255,255,0','0,255,0','0,255,255','0,0,255','255,0,255','255,0,0');
for(var i = 0 ; i < 6 ; i++){
ColorMainLayer = '<span class="Img1px" style="position:absolute; left:'+ (50 * i + CX) +'px; top:'+ CY +'px; width:50px;height:100px; background:rgb('+SevenColor[i]+')"></span><span class="Img1px" style="position:absolute; left:'+ (50 * i + CX) +'px; top:'+ CY +'px; width:50px; height:100px; background:rgb('+SevenColor[i+1]+'); filter:alpha(opacity=0,finishopacity=100,style=1);"></span>';
t[t.length]=(ColorMainLayer);
}
ColorMainLayer = '<span class="Img1px" style="position:absolute; left:'+CX+'px; top:'+CY+'px; width:300px; height:50px; background:rgb(255,255,255); filter:alpha(opacity=100,finishopacity=0,startX=0,startY=0,finishX=0,finishY=100,style=1)"></span><span class="Img1px" style="position:absolute; left:'+CX+'px; top:'+(50+CY)+'px; width:300px; height:50px; background:rgb(0,0,0); filter:alpha(opacity=0,finishopacity=100,startX=0,startY=0,finishX=0,finishY=100,style=1)"></span><span class="Img1px" style="position:absolute; left:'+CX+'px; top:'+CY+'px; width:300px; height:100px;" onmouseup="ePickColor(true);" onmousemove="ePickColor(false);if(event.button==1) ePickColor(true);"></span>';
t[t.length]=(ColorMainLayer);
delete CX,CY,ColorMainLayer,SevenColor,i;
return t.join("")
}
function eChangeR(w,t){
var k = new Array();
switch(w){
case 1:
var Rd = parseInt(event.offsetX * 256 / 300);
eColor1.style.background = 'rgb('+Rd+','+G2.value+','+B2.value+')';
if(t){
R2.value = Rd;
Rj.style.left = event.x - 8;
Rj.innerText = '∧' + R2.value;
eGreenD.style.background = 'rgb('+R2.value+',255,'+B2.value+')';
eGreenF.style.background = 'rgb('+R2.value+',0,'+B2.value+')';
eBlueD.style.background = 'rgb('+R2.value+','+G2.value+',255)';
eBlueF.style.background = 'rgb('+R2.value+','+G2.value+',0)';
eColor2.style.background = 'rgb('+Rd+','+G2.value+','+B2.value+')';
Rd = Rd>=10?Rd.toString(16).toUpperCase():'0'+Rd;
k[0] = G2.value>=10?parseInt(G2.value).toString(16).toUpperCase():'0'+G2.value;
k[1] = B2.value>=10?parseInt(B2.value).toString(16).toUpperCase():'0'+B2.value;
Color2HTML.value = '#'+Rd+k[0]+k[1];
WinReturnValue.value = Color2HTML.value;
}
delete Rd;
break;
case 2:
var Gd = parseInt(event.offsetX * 256 / 300);
eColor1.style.background = 'rgb('+R2.value+','+Gd+','+B2.value+')';
if(t){
G2.value = Gd;
Gj.style.left = event.x - 8;
Gj.innerText = '∧' + G2.value;
eRedD.style.background = 'rgb(255,'+G2.value+','+B2.value+')';
eRedF.style.background = 'rgb(0,'+G2.value+','+B2.value+')';
eBlueD.style.background = 'rgb('+R2.value+','+G2.value+',255)';
eBlueF.style.background = 'rgb('+R2.value+','+G2.value+',0)';
eColor2.style.background = 'rgb('+R2.value+','+Gd+','+B2.value+')';
Gd = Gd>=10?Gd.toString(16).toUpperCase():'0'+Gd;
k[0] = R2.value>=10?parseInt(R2.value).toString(16).toUpperCase():'0'+R2.value;
k[1] = B2.value>=10?parseInt(B2.value).toString(16).toUpperCase():'0'+B2.value;
Color2HTML.value = '#'+k[0]+Gd+k[1];
WinReturnValue.value = Color2HTML.value;
}
delete Gd;
break;
case 3:
var Bd = parseInt(event.offsetX * 256 / 300);
eColor1.style.background = 'rgb('+R2.value+','+B2.value+','+Bd+')';
if(t){
B2.value = Bd;
Bj.style.left = event.x - 8;
Bj.innerText = '∧' + B2.value;
eRedD.style.background = 'rgb(255,'+G2.value+','+B2.value+')';
eRedF.style.background = 'rgb(0,'+G2.value+','+B2.value+')';
eGreenD.style.background = 'rgb('+R2.value+',255,'+B2.value+')';
eGreenF.style.background = 'rgb('+R2.value+',0,'+B2.value+')';
eColor2.style.background = 'rgb('+R2.value+','+B2.value+','+Bd+')';
Bd = Bd>=10?Bd.toString(16).toUpperCase():'0'+Bd;
k[0] = R2.value>=10?parseInt(R2.value).toString(16).toUpperCase():'0'+R2.value;
k[1] = G2.value>=10?parseInt(G2.value).toString(16).toUpperCase():'0'+G2.value;
Color2HTML.value = '#'+k[0]+k[1]+Bd;
WinReturnValue.value = Color2HTML.value;
}
delete Bd;
break;
}
delete w,t,k;
}
function ePickColor(w){
var pX = event.offsetX;
var pY = event.offsetY;
var HalfH = 50;
H = parseInt(pX*360/300);
if(event.offsetY < HalfH){
S = pY/HalfH;
V = 1;
}
else{
S = 1;
V = (100-pY)/HalfH;
}
var t = HSVtoRGB(H, parseInt(S*100), parseInt(V*100),true);
eColor1.style.background = 'rgb('+t[0]+','+t[1]+','+t[2]+')';
if(w){
Rj.style.left = 43 + parseInt(t[0] * 300 / 255);
Rj.innerText = '∧' + t[0];
Gj.style.left = 43 + parseInt(t[1] * 300 / 255);
Gj.innerText = '∧' + t[1];
Bj.style.left = 43 + parseInt(t[2] * 300 / 255);
Bj.innerText = '∧' + t[2];
eGreenD.style.background = 'rgb('+R2.value+',255,'+B2.value+')';
eGreenF.style.background = 'rgb('+R2.value+',0,'+B2.value+')';
eBlueD.style.background = 'rgb('+R2.value+','+G2.value+',255)';
eBlueF.style.background = 'rgb('+R2.value+','+G2.value+',0)';
eRedD.style.background = 'rgb(255,'+G2.value+','+B2.value+')';
eRedF.style.background = 'rgb(0,'+G2.value+','+B2.value+')';
eBlueD.style.background = 'rgb('+R2.value+','+G2.value+',255)';
eBlueF.style.background = 'rgb('+R2.value+','+G2.value+',0)';
eRedD.style.background = 'rgb(255,'+G2.value+','+B2.value+')';
eRedF.style.background = 'rgb(0,'+G2.value+','+B2.value+')';
eGreenD.style.background = 'rgb('+R2.value+',255,'+B2.value+')';
eGreenF.style.background = 'rgb('+R2.value+',0,'+B2.value+')';
H2.value = H;
S2.value = parseInt(S*240);
V2.value = parseInt(V*240);
R2.value = t[0];
G2.value = t[1];
B2.value = t[2];
eColor2.style.background = 'rgb('+t[0]+','+t[1]+','+t[2]+')';
t[0]=t[0]>=10?t[0].toString(16).toUpperCase():'0'+t[0];
t[1]=t[1]>=10?t[1].toString(16).toUpperCase():'0'+t[1];
t[2]=t[2]>=10?t[2].toString(16).toUpperCase():'0'+t[2];
Color2HTML.value = '#'+t[0]+t[1]+t[2];
WinReturnValue.value = Color2HTML.value;
}
delete pX,pY,HalfH,H,S,V,t,w;
}
//=====[拾色器]
function drawColorSelBox(){
var CX = 270;
var CY = 40;
var ColorMainLayer = '';
var t=new Array()
var SevenColor = new Array('255,0,0','255,0,255','0,0,255','0,255,255','0,255,0','255,255,0','255,0,0');
for(var i = 0 ; i < 6 ; i++){
ColorMainLayer = '<span class="Img1px" style="position:absolute; left:'+ CX +'px; top:'+ (40 * i + CY) +'px; width:50px;height:40px; background:rgb('+SevenColor[i]+')"></span><span class="Img1px" style="position:absolute; left:'+ CX +'px; top:'+ (40 * i + CY) +'px; width:50px; height:40px; background:rgb('+SevenColor[i+1]+'); filter:alpha(startX=100,startY=0,finisthX=0,finishY=100,opacity=0,finishopacity=100,style=1);"></span>';
t[t.length]=(ColorMainLayer);
}
ColorMainLayer = '<span class="Img1px" style="position:absolute; left:'+ CX +'px; top:'+ CY +'px; width:50px;height:240px;" onClick="changeColorH(true);" onMouseMove="changeColorH(false);if(event.button==1) changeColorH(true);"></span>';
t[t.length]=(ColorMainLayer);
delete CX,CY,SevenColor,ColorMainLayer;
return t.join("")
}
function changeColorH(r){
var Hd = parseInt(event.offsetY * 361 / 240);
if(Hd < 0) Hd = 0;
var Md = HSVtoRGB((359 - Hd),parseInt(S3.value) * 100 / 240,parseInt(V3.value) * 100 / 240,true);
uColor1.style.background = 'rgb('+Md[0]+','+Md[1]+','+Md[2]+')';
if(r){
uColor2.style.background = 'rgb('+Md[0]+','+Md[1]+','+Md[2]+')';
uColorH.style.top = event.y - 7;
uColorH.innerText = '<' + (359 - Hd);
H3.value = (359 - Hd);
R3.value = Md[0];
G3.value = Md[1];
B3.value = Md[2];
Md[0] = Md[0]>=10?Md[0].toString(16).toUpperCase():'0'+Md[0];
Md[1] = Md[1]>=10?Md[1].toString(16).toUpperCase():'0'+Md[1];
Md[2] = Md[2]>=10?Md[2].toString(16).toUpperCase():'0'+Md[2];
Md[0] = Md[0].length == 1? '0'+Md[0]:Md[0];
Md[1] = Md[1].length == 1? '0'+Md[1]:Md[1];
Md[2] = Md[2].length == 1? '0'+Md[2]:Md[2];
Color3HTML.value = '#' + Md[0] + Md[1] + Md[2];
WinReturnValue.value = Color3HTML.value;
Md = HSVtoRGB((359 - Hd),1,1,false);
ChangeLayerColor.style.background = 'rgb('+Md[0]+','+Md[1]+','+Md[2]+')';
}
delete Hd,Md,r;
}
function uPickColorer(r){
var eX = event.offsetX;
var eY = 240 - event.offsetY;
var Cd = HSVtoRGB(H3.value,eX * 100 / 240,eY * 100 / 240,true);
uColor1.style.background = 'rgb('+Cd[0]+','+Cd[1]+','+Cd[2]+')';
if(r){
uColor2.style.background = 'rgb('+Cd[0]+','+Cd[1]+','+Cd[2]+')';
S3.value = eX;
V3.value = eY;
R3.value = Cd[0];
G3.value = Cd[1];
B3.value = Cd[2];
Cd[0] = Cd[0]>=10?Cd[0].toString(16).toUpperCase():'0'+Cd[0];
Cd[1] = Cd[1]>=10?Cd[1].toString(16).toUpperCase():'0'+Cd[1];
Cd[2] = Cd[2]>=10?Cd[2].toString(16).toUpperCase():'0'+Cd[2];
Cd[0] = Cd[0].length == 1? '0'+Cd[0]:Cd[0];
Cd[1] = Cd[1].length == 1? '0'+Cd[1]:Cd[1];
Cd[2] = Cd[2].length == 1? '0'+Cd[2]:Cd[2];
Color3HTML.value = '#' + Cd[0] + Cd[1] + Cd[2];
WinReturnValue.value = Color3HTML.value;
}
delete eX,eY,r,Cd;
}
//======[色环]
var CircleX = 96;
var CircleY = 120;
function drawCircleColor(){
var t3=new Array()
var CircleMinR = 70;
var CircleMaxR = 90;
var EX,EY,l;
var t;
for(;CircleMinR <= CircleMaxR;CircleMinR+=4){
for(j = 0;j <= 359;j++){
EX = parseInt(CircleMinR * Math.sin(3.14*j/180));
EY = parseInt(CircleMinR * Math.cos(3.14*j/180));
t = nForColor(j);
l = '<span class="img1px" H="'+j+','+CircleMinR+'" style="position:absolute; width:4px; height:4px; background:'+t+'; left:'+(CircleX+EX)+'px; top:'+(CircleY+EY)+'px;" onMouseDown="hidePoints();" onMouseUp="showPoints();getPointInfo(tModer.value);" onMouseOver="tColor1.style.background=\'\';tColor1.style.background=this.style.background;"></span>';
t3[t3.length]=l;
}
}
delete CircleMinR,CircleMaxR,EX,EY,l,t,j;
return t3.join("")
}
function nForColor(cNum){
var t = '';
if(cNum >= 300 && cNum <= 360){
cNum -= 300;
t = parseInt(255-cNum*4.25).toString(16);
if(t.length==1) t = '0' + t;
t = 'FF00' + t;
return(t);
}else if(cNum >= 240 && cNum <= 300){
cNum -= 240;
t = parseInt(cNum*4.25).toString(16);
if(t.length==1) t = '0' + t;
t += '00FF';
return(t);
}else if(cNum >= 180 && cNum <= 240){
cNum -= 180;
t = parseInt(255-cNum*4.25).toString(16);
if(t.length==1) t = '0' + t;
t = '00' + t + 'FF';
return(t);
}else if(cNum >= 120 && cNum <= 180){
cNum -= 120;
t = parseInt(cNum*4.25).toString(16);
if(t.length==1) t = '0' + t;
t = '00FF' + t;
return(t);
}else if(cNum >= 60 && cNum <= 120){
cNum -= 60;
t = parseInt(255-cNum*4.25).toString(16);
if(t.length==1) t = '0' + t;
t += 'FF00'
return(t);
}else{
t = parseInt(cNum*4.25).toString(16);
if(t.length==1) t = '0' + t;
t = 'FF' + t + '00'
return(t);
}
}
function hidePoints(){
for(i = 1 ; i <= tModer.value ; i++){
eval('tPoint'+i+'.style.display = "none";');
}
}
function showPoints(){
for(i = 1 ; i <= tModer.value ; i++){
eval('tPoint'+i+'.style.display = "block";');
}
}
function changeColorMode(){
var ModeNum = tModer.value;
for(i = 2 ; i <= 5 ; i++){
eval('tPoint'+i+'.style.display = "none";');
eval('tLine'+i+'.style.display = "none";')
}
for(i=2;i<=ModeNum;i++){
eval('tPoint'+i+'.style.display = "block";');
eval('tLine'+i+'.style.display = "block";')
}
var t = '',a = 360 / ModeNum;
var l = parseInt(H4.value);
for(i = 2; i <= ModeNum ; i++){
l += a;
l %= 360;
t = nForColor(l);
r = NumToDec(t.substring(0,2),16);
g = NumToDec(t.substring(2,4),16);
b = NumToDec(t.substring(4,6),16);
eval('tColorMode'+i+'.style.background="rgb('+r+','+g+','+b+')";');
eval('tPointColor'+i+'.value = "'+l+'"');
EX = CircleX + parseInt(CurAa.value * Math.sin(3.14 * l / 180)) - 3;
EY = CircleY + parseInt(CurAa.value * Math.cos(3.14 * l / 180));
eval('tPoint'+i+'.style.left = "'+ EX +'px";');
eval('tPoint'+i+'.style.top = "'+ EY +'px";');
}
switch(ModeNum){
case '5':
tPlantz1.style.left = 198;
tPlantz2.style.left = 236;
tPlantz3.style.left = 274;
tPlantz4.style.left = 312;
tPlantz5.style.left = 351;
break;
case '4':
tPlantz1.style.left = 202;
tPlantz2.style.left = 249;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -