1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21:
|
<?php
function colorconvert($color) // Konvertiert Hex-Farbcode in RGB-Array
{
$colors = Array();
if(strlen($color) == 6)
{
$colors[0] = @hexdec(substr($color, 0, 2));
$colors[1] = @hexdec(substr($color, 2, 2));
$colors[2] = @hexdec(substr($color, 4, 2));
if($colors[0] > 255 || $colors[0] < 0) { $colors[0] = 0; }
if($colors[1] > 255 || $colors[1] < 0) { $colors[1] = 0; }
if($colors[2] > 255 || $colors[2] < 0) { $colors[2] = 0; }
}
else
{
$colors[0] = 0;
$colors[1] = 0;
$colors[2] = 0;
}
return $colors;
}
?>
|