PHP Class Jyxo\Color

Author: Roman Řáha
Afficher le fichier Open project: jyxo/php

Méthodes publiques

Méthode Description
__construct ( mixed $color = null ) Constructor.
__toString ( ) : string Returns textual (#RRGGBB) representation of the current color.
getBinary ( ) : integer Returns the current color in binary form 0 - black, 1 - white).
getBlue ( ) : integer Returns the blue component luminance.
getGreen ( ) : integer Returns the green component luminance.
getHex ( ) : string Returns the current color as a six-digit hexadecimal number.
getLuminance ( ) : integer Returns the color luminance according to the human perception.
getRed ( ) : integer Returns the red component luminance.
getRgb ( ) : array Returns the current color as an array of the red, green and blue components.
setBlue ( integer | string $blue ) : self Sets the blue component luminance.
setGreen ( integer | string $green ) : self Sets the green component luminance.
setLuminance ( integer | string $luminance ) : self Sets the color in grayscale according to the luminance value.
setRed ( integer | string $red ) : self Sets the red component luminance.
toGrayScale ( ) : self Returns the currect color converted to grayscale.
toInverse ( ) : self Returns an inverse color.

Private Methods

Méthode Description
initFromHex ( string $hex ) : self Sets color components using a hexadecimal RRGGBB string.
initFromInt ( integer $int ) : self Sets color components from an integer.
initFromRgb ( array $rgb ) : self Sets color components from an array.
toInt ( integer | string $value ) : integer Returns the color luminance as a decimal integer.

Method Details

__construct() public méthode

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, * {@link \Jyxo\Color}, * null
public __construct ( mixed $color = null )
$color mixed Color definition

__toString() public méthode

Returns textual (#RRGGBB) representation of the current color.
public __toString ( ) : string
Résultat string

getBinary() public méthode

Returns the current color in binary form 0 - black, 1 - white).
public getBinary ( ) : integer
Résultat integer

getBlue() public méthode

Returns the blue component luminance.
public getBlue ( ) : integer
Résultat integer

getGreen() public méthode

Returns the green component luminance.
public getGreen ( ) : integer
Résultat integer

getHex() public méthode

Returns the current color as a six-digit hexadecimal number.
public getHex ( ) : string
Résultat string

getLuminance() public méthode

Returns the color luminance according to the human perception.
public getLuminance ( ) : integer
Résultat integer

getRed() public méthode

Returns the red component luminance.
public getRed ( ) : integer
Résultat integer

getRgb() public méthode

Returns the current color as an array of the red, green and blue components.
public getRgb ( ) : array
Résultat array

setBlue() public méthode

Sets the blue component luminance.
public setBlue ( integer | string $blue ) : self
$blue integer | string Component luminance
Résultat self

setGreen() public méthode

Sets the green component luminance.
public setGreen ( integer | string $green ) : self
$green integer | string Component luminance
Résultat self

setLuminance() public méthode

Sets the color in grayscale according to the luminance value.
public setLuminance ( integer | string $luminance ) : self
$luminance integer | string Luminance
Résultat self

setRed() public méthode

Sets the red component luminance.
public setRed ( integer | string $red ) : self
$red integer | string Component luminance
Résultat self

toGrayScale() public méthode

Returns the currect color converted to grayscale.
public toGrayScale ( ) : self
Résultat self

toInverse() public méthode

Returns an inverse color.
public toInverse ( ) : self
Résultat self