|Classes of Christian Vigh||>||Color Tools||>||README.md||>||Download|
The Color class allows for conversion between different colorimetric models, namely :
Instantianting a Color object will automatically convert the color you supplied to all the other colorimetric schemes :
The above example found the color you specified in the ColorNames.txt file, and converted this color name to all other colorimetric models currently support, which are accessible as properties ; for example :
is an array of three elements, containing the Red, Green and Blue parts of the color you supplied to the constructor (White), so it will contain the values 0xFF, 0xFF and 0xFF.
You can reuse an existing Color object to specify another color, using the SetColor() method :
The class will recognize the specified value to be "Blue", a value which will be accessible through the $ColorName property.
See the Reference section for more information about methods, properties and constants available for this class.
Creates a Color object using the specified color value, which can have one of the following forms :
Color names are not case-sensitive, as well as keywords such as RGB, GRAYSCALE, etc.
If a single integer or an array of bytes is specified, the caller must specify a constant of type COLOR\_SCHEME\_\* to indicate which colorimetric model is to be used for interpreting the value.
Normalizes an RGB value by applying the following process :
The function returns the normalized RGB value as a string, or false if an error occurred.
Assigns a new color to the specified object. All the colorimetric properties are recomputed after that.
Returns an associative array having the following entries :
All the properties listed in the following section should be considered as read-only.
The normalized RGB color, that can be used as is for any css or HTML color attribute.
Human-readable color name. This value will be an empty string if the color has no correspondance in the file ColorNames.txt.
A set of 3 byte values for the RGB colorimetric model.
A set of 3 byte values for the HSL colorimetric model.
A set of 3 byte values for the HSB colorimetric model.
A set of 3 byte values for the CMY colorimetric model.
A set of 4 byte values for the CMYK colorimetric model.
A set of 3 byte values for the Websafe RGB colorimetric model.
A set of 3 byte values corresponding to the grayscale version of the underlying color.
The Color class defines the following constants, which indicate the colorimetric model associated to a string ; such a constant must be specified to either the class constructor or the SetValue() method, when the specified value does not allow to determine which colorimetric model is to be used :