In case a package has to deal with colors, it is recommended that developers store and use an array representation of the color values in their PEAR packages. All values are in the range of 0..255.
The following snippet defines an array that holds the RGB definition of the green coloring that is used in the official PEAR logo.
$color = array(0x33, 0x99, 0x00);
$color = array(51, 153, 0);
Since this an extension of the RGB representation above, it is recommended to use a forth value for alpha-channel-prepresentation. An example of the "PEAR-green" with aprox. 80% intensity would be:
$color = array(0x33, 0x99, 0x00, 0xCC);
Please note this is in contrast to the alpha-value used by imagecolorallocate(). The alpha-representation used in PEAR was choosen for consistency with the other RGB values and because it is commonly accepted practise in many other applications (image-processing tools, etc.).
Since RGB/RGBA will used for graphic generation on a computer we decided to leave out an optional type-identifier classifying colors as RGB/RGBA. However for different color-representations an identifier is needed. The optional identifier "type" can be added to the color array.
$color = array(0x33, 0x99, 0x00, 0xCC, "type" => "RGB");
RGB - red, green, blue
CYMK - cyan, yellow, magenta, black (key)
Please note that also the RGBA representation has the type "RGB" since it's closely related.
The PEAR-package Image_Color will (hopefully soon) contain all needed functions to convert arbitrary color formats to the internal RGBA representation and convert different color representations.
Status: Currently Image_Color already offers functions to convert color-names (e.g. "green") and hex-representations-strings (e.g. "#339900") to the PEAR-RGBA-format. We are working to get alpha- channel support added hopefully soon and will later add funtions for CYMK-conversion as well.