- <HTML>
- <HEAD>
- <TITLE></TITLE>
- <STYLE>
- .ColorCell{width: 3; height: 3}
- .GradientColorCell{width: 5; height: 20}
- </STYLE>
- <SCRIPT>
- // convertion decimal ver hexa
- function Hexa(Dec){
- var nb = Dec.toString(16)
- if (nb.length < 2) {nb = "0" + nb}
- return(nb)
- }
- function GradientPart(dr, dg, db, fr, fg, fb, Step) {
- cr=dr;cg=dg;cb=db
- // Calcul du pas par couleur
- sr=((fr-dr)/Step) // rouge
- sg=((fg-dg)/Step) // vert
- sb=((fb-db)/Step) // bleu
- var Result = ''
- for (var x = 0; x <= Step; x++) {
- var cmd = " onclick=\"ColorCode.value=this.bgColor;\" onmouseover=\"ColorShow.style.backgroundColor=this.bgColor;\""
- Result += "<TD CLASS=ColorCell BGCOLOR=#" + Hexa(Math.floor(cr)) + Hexa(Math.floor(cg)) + Hexa(Math.floor(cb)) + cmd + "></TD>"
- cr += sr; cg += sg; cb += sb
- }
- return(Result)
- }
- function WriteRow(a,i){
- document.write("<TR>")
- document.write(GradientPart(a,i,i, a,a,i, StepH))
- document.write(GradientPart(a,a,i ,i,a,i, StepH))
- document.write(GradientPart(i,a,i, i,a,a, StepH))
- document.write(GradientPart(i,a,a, i,i,a, StepH))
- document.write(GradientPart(i,i,a, a,i,a, StepH))
- document.write(GradientPart(a,i,a, a,i,i, StepH))
- document.write("</TR>")
- }
- </SCRIPT>
- </HEAD>
- <BODY>
-
- <TABLE>
- <TR>
- <TD COLSPAN=2>
-
- <SCRIPT>
- // ecriture du tableau de dégradé
- document.write("<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 STYLE='border: 1px solid black'>")
- StepH = 20
- var StepV = 8
- var i=0
- var a=0
- // niveau foncé
- for (a=0;a<=255; a+=StepV){
- WriteRow(a,i)
- }
- a=255
- // niveau clair
- for (i=0; i<=255; i+=StepV){
- WriteRow(a,i)
- }
- document.write("</TABLE>")
- </SCRIPT>
-
- </TD>
- </TR>
- <TR>
- <TD>
- <DIV ID=ColorShow STYLE="width: 100; height: 60; border: 1px solid black"></DIV>
- </TD>
- <TD>
- Code couleur : <INPUT ID=ColorCode TYPE=text SIZE=8>
- </TD>
- </TR>
- </TABLE>
-
-
- </BODY>
- </HTML>
-
<HTML>
<HEAD>
<TITLE></TITLE>
<STYLE>
.ColorCell{width: 3; height: 3}
.GradientColorCell{width: 5; height: 20}
</STYLE>
<SCRIPT>
// convertion decimal ver hexa
function Hexa(Dec){
var nb = Dec.toString(16)
if (nb.length < 2) {nb = "0" + nb}
return(nb)
}
function GradientPart(dr, dg, db, fr, fg, fb, Step) {
cr=dr;cg=dg;cb=db
// Calcul du pas par couleur
sr=((fr-dr)/Step) // rouge
sg=((fg-dg)/Step) // vert
sb=((fb-db)/Step) // bleu
var Result = ''
for (var x = 0; x <= Step; x++) {
var cmd = " onclick=\"ColorCode.value=this.bgColor;\" onmouseover=\"ColorShow.style.backgroundColor=this.bgColor;\""
Result += "<TD CLASS=ColorCell BGCOLOR=#" + Hexa(Math.floor(cr)) + Hexa(Math.floor(cg)) + Hexa(Math.floor(cb)) + cmd + "></TD>"
cr += sr; cg += sg; cb += sb
}
return(Result)
}
function WriteRow(a,i){
document.write("<TR>")
document.write(GradientPart(a,i,i, a,a,i, StepH))
document.write(GradientPart(a,a,i ,i,a,i, StepH))
document.write(GradientPart(i,a,i, i,a,a, StepH))
document.write(GradientPart(i,a,a, i,i,a, StepH))
document.write(GradientPart(i,i,a, a,i,a, StepH))
document.write(GradientPart(a,i,a, a,i,i, StepH))
document.write("</TR>")
}
</SCRIPT>
</HEAD>
<BODY>
<TABLE>
<TR>
<TD COLSPAN=2>
<SCRIPT>
// ecriture du tableau de dégradé
document.write("<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 STYLE='border: 1px solid black'>")
StepH = 20
var StepV = 8
var i=0
var a=0
// niveau foncé
for (a=0;a<=255; a+=StepV){
WriteRow(a,i)
}
a=255
// niveau clair
for (i=0; i<=255; i+=StepV){
WriteRow(a,i)
}
document.write("</TABLE>")
</SCRIPT>
</TD>
</TR>
<TR>
<TD>
<DIV ID=ColorShow STYLE="width: 100; height: 60; border: 1px solid black"></DIV>
</TD>
<TD>
Code couleur : <INPUT ID=ColorCode TYPE=text SIZE=8>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>