Pour éditer le wiki, il faut demander un compte à un Lapin !
Difference between revisions of "GenerationDePaletteDeCouleurs"
From Le L∞p's Wiki
(Created page with "== generation de palette de couleur == un petit script naif pour generer une palette de 24 couleurs, potentiellement adequate pour du graphing Usage: ./palette.pl | sed 's/1...") |
m (+cat) |
||
(6 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 8: | Line 6: | ||
<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 ) { |
− | + | $v = $v1 / 4; | |
− | for $v1 ( 4,3 ) { | + | 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\">&nbsp;</span>\n",$r[$ti]*256,$g[$ti]*256,$b[$ti]*256); | |
− | + | } | |
− | + | ||
} | } | ||
} | } | ||
− | + | print "</body></html>\n"; | |
+ | </code> | ||
− | + | [[Category:Documentation]] | |
− | + |
Latest revision as of 21: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";