Exemple #1
0
function get_col($value)
{
    list($r, $g, $b) = HSV_TO_RGB($value, 1, 0.9);
    return sprintf('%02X%02X%02X', $r, $g, $b);
}
function convert_html_color($html)
{
    global $hue, $sat;
    $RGB = html2rgb($html);
    //convert html to rgb
    $HSV = RGB_TO_HSV($RGB[0], $RGB[1], $RGB[2]);
    // convert rgb to hsv, which are percentages
    $huechange = ($hue + 100) / 200;
    //find the percentage change from the imagemagick command
    $newH = $HSV['H'] + $huechange;
    if ($newH > 1) {
        $newH = $newH - 1;
    }
    $newS = $HSV['S'] * ($sat / 100);
    $newRGB = HSV_TO_RGB($newH, $newS, $HSV['V']);
    $newHTML = rgb2html($newRGB['R'], $newRGB['G'], $newRGB['B']);
    return $newHTML;
}