// HEX to RGB
function getrgb($color){
$chars = preg_split('//', $color, -1, PREG_SPLIT_NO_EMPTY);
$color = array();
$char[0] = $chars[1].$chars[2];
$char[1] = $chars[3].$chars[4];
$char[2] = $chars[5].$chars[6];
$color[0] = hexdec($char[0]);
$color[1] = hexdec($char[1]);
$color[2] = hexdec($char[2]);
return $color;
}
function sendlanbox($string){
$lanboxip = "192.168.1.77";
$lanboxpwd = "777";
$fp = fsockopen("$lanboxip", $lanboxpwd, $errno, $errstr, 10);
if (!$fp) {
echo "$errstr ($errno)
\n";
} else {
$out = "$lanboxpwd\r\n";
fwrite($fp, $out);
fgets($fp, 26);
$out = htmlspecialchars($string) ;
// echo "
Out = $out";
fwrite($fp, $out);
stream_set_timeout($fp, 3); // data timeout in secs
// echo "
Result = ";
// echo fread($fp, (100));
// echo "send $string\n";
fclose($fp);
}
}
function zfill($n,$a) {
return str_repeat("0",max(0,$a-strlen($n))).$n;
}
// Rode kleuren
$color['indischrood'] = 'CD5C5C';
$color['lichtkoraal'] = 'F08080';
$color['zalm'] = 'FA8072';
$color['donkerzalm'] = 'E9967A';
$color['oranjerood'] = 'FF4500';
$color['rood'] = 'FF0000';
$color['vermiljoen'] = 'DC143C';
$color['vuurvastebaksteen'] = 'B22222';
$color['donkerrood'] = '8B0000';
// Roze kleuren
$color['roze'] = 'FFC0CB';
$color['lichtroze'] = 'FFB6C1';
$color['acaciaroze'] = 'FF69B4';
$color['dieproze'] = 'FF1493';
$color['middenvioletrood'] = 'C71585';
// Gele kleuren
$color['lichtgeel'] = 'FFFFE0';
$color['kaki'] = 'F0E68C';
$color['geel'] = 'FFFF00';
$color['goud'] = 'FFD700';
$color['donkerkaki'] = 'BDB76B';
// Blauwe kleuren
$color['lichtcyaan'] = 'E0FFFF';
$color['lichtturquoise'] = 'AFEEEE';
$color['cyaan'] = '00FFFF';
$color['aquamarijn'] = '7FFFD4';
$color['turquoise'] = '40E0D0';
$color['donkerturquoise'] = '00CED1';
$color['staalblauw'] = 'B0C4DE';
$color['lichtblauw'] = 'ADD8E6';
$color['hemelsblauw'] = '87CEEB';
$color['lichthemelsblauw'] = '87CEFA';
$color['diephemelsblauw'] = '00BFFF';
$color['korenbloemblauw'] = '6495ED';
$color['donkerstaalblauw'] = '4682B4';
$color['koningsblauw'] = '4169E1';
$color['blauw'] = '0000FF';
$color['middenblauw'] = '0000CD';
$color['donkerblauw'] = '00008B';
$color['marine '] = '000080';
$color['midnachtsblauw'] = '191970';
// Orange kleuren
$color['lichtzalm'] = 'FFA07A';
$color['oranje'] = 'FFA500';
$color['donkeroranje'] = 'FF8C00';
$color['koraal'] = 'FF7F50';
$color['tomaat'] = 'FF6347';
$color['oranjerood'] = 'FF4500';
// Groene kleuren
$color['groengeel'] = 'ADFF2F';
$color['Groen'] = '7FFF00';
$color['grasgroen'] = '7CFC00';
$color['bleekgroen'] = '98FB98';
$color['lichtgroen'] = '90EE90';
$color['midlentegroen'] = '00FA9A';
$color['lentegroen'] = '00FF7F';
$color['zeegroen'] = '2E8B57';
$color['bosgroen'] = '228B22';
$color['donkergroen'] = '008000';
$color['olijfgroen'] = '808000';
$color['donkerolijfgroen'] = '556B2F';
$color['donkergroen'] = '006400';
$color['aquamarijn'] = '7FFFD4';
$color['donkerzeegroen'] = '8FBC8F';
$color['lichtzeegroen'] = '20B2AA';
$color['donkercyaan'] = '008B8B';
// Paarse kleuren
$color['lavendel'] = 'E6E6FA';
$color['distel'] = 'D8BFD8';
$color['pruim'] = 'DDA0DD';
$color['violet'] = 'EE82EE';
$color['fuchsia'] = 'FF00FF';
$color['orchidee'] = 'DA70D6';
$color['blauwviolet'] = '8A2BE2';
$color['donkerviolet'] = '9400D3';
$color['donkermagenta'] = '8B008B';
$color['purper'] = '800080';
$color['indigo'] = '4B0082';
// Bruine kleuren
$color['chocoladebruin'] = 'D2691E';
$color['Gebrandesienna'] = 'A0522D';
$color['bruin'] = 'A52A2A';
$color['kastanjebruin'] = '800000';
// Witte kleuren
$color['wit'] = 'FFFFFF';
$color['sneeuwwit'] = 'FFFAFA';
$color['Azuur'] = 'F0FFFF';
$color['rookwit'] = 'F5F5F5';
$color['schelp'] = 'FFF5EE';
$color['beige'] = 'F5F5DC';
$color['Kant'] = 'FDF5E6';
$color['ivoor'] = 'FFFFF0';
$color['linnen'] = 'FAF0E6';
// Grijze kleuren
$color['lichtgrijs'] = 'D3D3D3';
$color['zilverSilver'] = 'C0C0C0';
$color['donkergrijs'] = 'A9A9A9';
$color['grijs'] = '808080';
$color['lichtleigrijs'] = '778899';
$color['leigrijs'] = '708090';
$color['donkerleigrijs'] = '2F4F4F';
$color['zwart'] = '000000';
$lampen['keukenblad'] = '01:02:03';
$lampen['videonder'] = '05:06:07';
$lampen['videboven'] = '10:11:12';
$lampen['tvmeubel'] = '16:17:18';
$lampen['bedonder'] = '32:33:34';
$lampen['bedachter'] = '64:65:66';
if (!isset($_GET['action'])) {
print "
";
print "Kleur | Hex | Voorbeeld | Rgb R | Rgb G | Rgb B |
\n";
foreach ($color as $key => $value) {
print "\n";
$rgb = getrgb($value);
print "$key | \n";
print "$value | \n";
print " | \n";
print "$rgb[0] | ";
print "$rgb[1] | ";
print "$rgb[2] | ";
print "
\n";
}
}
else {
// Voorbereiden regel
$ini = "*C901"; // Engine 01 is used
$cch1 = dechex($_GET['ch1']);
$cch2 = dechex($_GET['ch2']);
$cch3 = dechex($_GET['ch3']);
$ch1 = zfill($cch1, 2);
$ch2 = zfill($cch2, 2);
$ch3 = zfill($cch3, 2);
$color = $_GET['hex'];
$splitcolor = wordwrap($color, 2, ":", true);
list($r, $g, $b) = split(":", $splitcolor, 3);
$cmd = "$ini$ch1$r$ch2$g$ch3$b#";
sendlanbox("*4D0103#*4E011C#");
sendlanbox($cmd);
}
?>