} if ($type_test == "cmy") { $c->set_from_cmy($v1, $v2, $v3); $values = $c->get_cmy(); } if ($type_test == "cmyk") { $c->set_from_cmyk($v1, $v2, $v3, 0.5); $values = $c->get_cmyk(); } if ($type_test == "luv") { $c->set_from_luv($v1, $v2, $v3); $values = $c->get_luv(); } if ($type_test == "hsl") { $c->set_from_hsl($v1, $v2, $v3); $values = $c->get_hsl(); } echo "<td bgcolor=#" . $c->get_rgbhex() . ">"; if (round($v1, 2) != round($values[0], 2)) { echo $v1 . "-" . $values[0] . "<br>\n"; } if (round($v2, 2) != round($values[1], 2)) { echo $v2 . "-" . $values[1] . "<br>\n"; } if (round($v3, 2) != round($values[2], 2)) { echo $v3 . "-" . $values[2]; } echo "</td>\n"; } echo "</tr>\n"; }
<?php require_once "class_color.inc.php"; $c = new color(); $c->set_from_rgb(224, 200, 226); echo "<table>\n"; echo "<tr>\n"; for ($i = 0; $i > -1; $i -= 0.05) { $c2 = new color(); $c2->set_from_rgb(224, 200, 226); $temp = $c2->get_hsl(); echo "avant:" . $temp[0] . " " . $temp[1] . " " . $temp[2]; $c2->mod_l_hsl($i); $temp = $c2->get_hsl(); echo "apres:" . $temp[0] . " " . $temp[1] . " " . $temp[2] . "<br>"; echo "<td bgcolor=#" . $c2->get_rgbhex() . "> </td>\n"; } echo "</tr>\n"; echo "</table>\n";