Pour éditer le wiki, il faut demander un compte à un Lapin !
Difference between revisions of "GenerationDePaletteDeCouleurs"
From Le L∞p's Wiki
(→generation de palette de couleur) |
m (+cat) |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | + | Un petit script naif pour generer une palette de 24 couleurs, potentiellement adequate pour du graphing | |
− | + | ||
− | + | ||
Usage: ./palette.pl | sed 's/100/ff/g' > ./palette.html | Usage: ./palette.pl | sed 's/100/ff/g' > ./palette.html | ||
Line 9: | Line 7: | ||
<code> | <code> | ||
#!/usr/bin/perl | #!/usr/bin/perl | ||
− | |||
print "<html> <head><title>palette</title></head> <body>\n"; | print "<html> <head><title>palette</title></head> <body>\n"; | ||
− | |||
for $v1 ( 4,3 ) { | for $v1 ( 4,3 ) { | ||
$v = $v1 / 4; | $v = $v1 / 4; | ||
Line 26: | Line 22: | ||
@g = ($n,$v,$v,$m,$l,$l); | @g = ($n,$v,$v,$m,$l,$l); | ||
@b = ($l,$l,$n,$v,$v,$m); | @b = ($l,$l,$n,$v,$v,$m); | ||
− | printf(" | + | printf("<span style=\"background-color : #%.2x%.2x%.2x\">&nbsp;</span>\n",$r[$ti]*256,$g[$ti]*256,$b[$ti]*256); |
} | } | ||
} | } | ||
} | } | ||
− | |||
print "</body></html>\n"; | print "</body></html>\n"; | ||
</code> | </code> | ||
+ | |||
+ | [[Category:Documentation]] |
Latest revision as of 22:31, 12 December 2012
Un petit script naif pour generer une palette de 24 couleurs, potentiellement adequate pour du graphing
Usage: ./palette.pl | sed 's/100/ff/g' > ./palette.html
Patches welcome
#!/usr/bin/perl
print "<html> <head><title>palette</title></head> <body>\n";
for $v1 ( 4,3 ) {
$v = $v1 / 4;
for $s1 ( 2 ) {
$s = $s1/2;
for $h1 (0,1,2,3,4,5,6,7,8,9,10,11) {
$h = $h1 * 30;
$ti = int($h/60) % 6;
$f = $h/60 - $ti;
$l = $v * (1 - $s);
$m = $v * (1 - $f * $s);
$n = $v * (1 - (1 - $f) * $s);
@r = ($v,$m,$l,$l,$n,$v);
@g = ($n,$v,$v,$m,$l,$l);
@b = ($l,$l,$n,$v,$v,$m);
printf("<span style=\"background-color : #%.2x%.2x%.2x\"> </span>\n",$r[$ti]*256,$g[$ti]*256,$b[$ti]*256);
}
}
}
print "</body></html>\n";