|Info||Example||View files (4)||Download .zip||Reputation||Support forum||Blog||Links|
|Ratings||Unique User Downloads||Download Rankings|
|Not enough user ratings||Total: 125||All time: 9,360 This week: 238|
|colortools 1.0.0||BSD License||5||PHP 5, Graphics|
This class can convert colors between different color models.
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 :
$color = new Color ( 'White' ) ;
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 :
$color -> RGB
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 :
$color -> SetColor ( '#0000FF' ) ;
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.
$color = new Color ( $value, $model = null ) ;
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.
$result = Color::NormalizedRGBValue ( $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.
$color -> SetColor ( $value, $model = null ) ;
Assigns a new color to the specified object. All the colorimetric properties are recomputed after that.
$array = $color -> ToArray ( ) ;
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 :
|Version Control||Unique User Downloads||Download Rankings|
|Applications that use this package|
If you know an application of this package, send a message to the author to add a link here.