Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
programming:web_safe_colors [2014/07/09 11:47] – creata Giuseppe Di Terlizzi | programming:web_safe_colors [2015/01/20 14:02] (current) – Giuseppe Di Terlizzi | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Web Safe Colors ====== | ====== Web Safe Colors ====== | ||
+ | |||
+ | {{https:// | ||
+ | |||
+ | Per ricavare velocemente l' | ||
+ | |||
+ | <code php> | ||
+ | $hex = array(' | ||
+ | $colors = array(); | ||
+ | |||
+ | foreach ($hex as $col1) { | ||
+ | foreach ($hex as $col2) { | ||
+ | foreach ($hex as $col3) { | ||
+ | $colors[] = " | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ===== Tabella dei colori ===== | ||
<php> | <php> | ||
Line 8: | Line 27: | ||
foreach ($hex as $c2) { | foreach ($hex as $c2) { | ||
foreach ($hex as $c3) { | foreach ($hex as $c3) { | ||
- | $colors[] = " | + | $colors[] = array(' |
} | } | ||
} | } | ||
} | } | ||
- | echo '<div class=" | + | $i=0; |
+ | $x=0; | ||
+ | |||
+ | echo '<table style=" | ||
foreach ($colors as $color) { | foreach ($colors as $color) { | ||
- | $x++; | ||
- | if ($x <= 72) { | ||
- | echo "< | ||
- | } | ||
- | } | ||
- | echo '</ | + | $c_hex |
+ | $c_dec | ||
+ | $b_color = ((int)(hexdec(substr($color[' | ||
+ | $test = hexdec(substr($color[' | ||
+ | $x_hex | ||
+ | $y_hex | ||
- | echo '<div class=" | + | if ($i>1 && ($i%6) == 0) { |
+ | if ($x==6) { $x=0; } | ||
+ | | ||
+ | $x++; | ||
+ | } | ||
- | foreach | + | if (($i%6) == 0) { |
- | $y++; | + | echo '</ |
- | if ($y > 72 && $y <= 144) { | + | if ($x_tmp !== $x_hex) { |
- | echo "< | + | echo '<td style=" |
+ | } | ||
} | } | ||
- | } | ||
- | echo '</tbody></table></div>'; | + | |
- | echo '< | + | $i++; |
+ | $x_tmp | ||
- | foreach ($colors as $color) { | ||
- | $z++; | ||
- | if ($z >144) { | ||
- | echo "< | ||
- | } | ||
} | } | ||
- | + | echo '<td>FF</td></tr></table>'; | |
- | echo '</tbody></table></div>'; | + | |
- | + | ||
- | echo '< | + | |
</ | </ | ||
- | {{tag> | + | {{tag> |
~~NOCACHE~~ | ~~NOCACHE~~ |