Class Jyxo_Color
Class representing a RGB color.
Methods summary
public
|
#
__construct( mixed $color = null )
Constructor.
Accepts the following definition formats:
- Hexadecimal string (with or without the hashmark at the beginning)
- Array with red, green and blue component luminance values (in this
order)
- Number,
Jyxo_Color ,
- null
Parameters
- $color
mixed Color definition
|
public
Jyxo_Color
|
#
toInverse( )
Returns an inverse color.
Returns an inverse color.
Returns
|
public
Jyxo_Color
|
#
toGrayScale( )
Returns the currect color converted to grayscale.
Returns the currect color converted to grayscale.
Returns
|
public
string
|
#
__toString( )
Returns textual (#RRGGBB) representation of the current color.
Returns textual (#RRGGBB) representation of the current color.
Returns
string
|
public
array
|
#
getRgb( )
Returns the current color as an array of the red, green and blue
components.
Returns the current color as an array of the red, green and blue
components.
Returns
array
|
public
string
|
#
getHex( )
Returns the current color as a six-digit hexadecimal number.
Returns the current color as a six-digit hexadecimal number.
Returns
string
|
public
integer
|
#
getBinary( )
Returns the current color in binary form 0 - black, 1 - white).
Returns the current color in binary form 0 - black, 1 - white).
Returns
integer
|
public
integer
|
#
getRed( )
Returns the red component luminance.
Returns the red component luminance.
Returns
integer
|
public
Jyxo_Color
|
#
setRed( integer|string $red )
Sets the red component luminance.
Sets the red component luminance.
Parameters
- $red
integer|string Component luminance
Returns
|
public
integer
|
#
getGreen( )
Returns the green component luminance.
Returns the green component luminance.
Returns
integer
|
public
Jyxo_Color
|
#
setGreen( integer|string $green )
Sets the green component luminance.
Sets the green component luminance.
Parameters
- $green
integer|string Component luminance
Returns
|
public
integer
|
#
getBlue( )
Returns the blue component luminance.
Returns the blue component luminance.
Returns
integer
|
public
Jyxo_Color
|
#
setBlue( integer|string $blue )
Sets the blue component luminance.
Sets the blue component luminance.
Parameters
- $blue
integer|string Component luminance
Returns
|
public
integer
|
#
getLuminance( )
Returns the color luminance according to the human perception.
Returns the color luminance according to the human perception.
Returns
integer
|
public
Jyxo_Color
|
#
setLuminance( integer|string $luminance )
Sets the color in grayscale according to the luminance value.
Sets the color in grayscale according to the luminance value.
Parameters
- $luminance
integer|string Luminance
Returns
|