ActiveState::Color(3)

NAME
ActiveState::Color - Collection of color conversion functions

SYNOPSIS
 use ActiveState::Color qw(name_from_rgb rgb_from_name
                           rgb_from_hsv hsv_from_rgb
                          );
 my($h, $s, $v) = hsv_from_rgb(rgb_from_name(shift));
 # make the color fully saturated and a bit lighter
 $s = 1; $v *= 1.2;
 print name_from_rgb(rgb_from_hsv($h, $s, $v)), "\n";

DESCRIPTION
The following functions are provided:

($r, $g, $b) = rgb_from_name( $name )
    This will convert a color name or a hex RGB-tripplet to a decimal RGB value with $r, $g, $b in the range 0.0 to 1.0. The hex tripplet can have any precision and can optionally be prefixed with "#". If the name is not recognized this function will croak. Examples of valid names are:

        #F0F
        #FF00FF
        #FFF000FFF
        ff00ff
        black
        BLACK
        yellow

$hexname = hex_from_rgb( $r, $g, $b )
    This converts a decimal RGB value with $r, $g, $b in the range 0.0 to 1.0 to an 8-bit hex RGB-tripplet. The output will be on the form:

        #ff00ff

$name = name_from_rgb( $r, $g, $b )
    This will convert a decimal RGB value to a color name. If the color is one of the 8 primary RGB colors then the name will be returned, otherwise a hex RGB-tripplet is returned. The 8 primary color names are:

        black
        blue
        cyan
        green
        magenta
        red
        yellow
        white

($r, $g, $b) = rgb_from_hsv( $h, $s, $v )
($h, $s, $v) = rgb_from_hsv( $r, $g, $b )
    These functions convert between the RGB and HSV color space. The range of $s, $v, $r, $g, and $b is 0.0 to 1.0. The range of $h is 0.0 to 360.0.

BUGS
none.