Class Color
Color helper
Create color contrasts and convert color values to various formats
Methods summary
public
Color
|
#
hex( string $color )
Sets the current color to the given hex or HTML hex value
Sets the current color to the given hex or HTML hex value
Parameters
- $color
string $color The given color in hex or HTMl hex value
Returns
|
public
Color
|
#
rgb( array $color )
Sets the current color to the given RGB value
Sets the current color to the given RGB value
Returns
|
public
Color
|
#
contrast50( )
Finds the constrast of the current color using the 50/50 method then sets it
as the internal color
Finds the constrast of the current color using the 50/50 method then sets it
as the internal color
Returns
|
public
Color
|
#
contrastYiq( )
Finds the constrast of the current color in YIQ space then sets it as the
internal color
Finds the constrast of the current color in YIQ space then sets it as the
internal color
Returns
|
public
string
|
#
asHtml( )
Convert the internal color to HTML hex color
Convert the internal color to HTML hex color
Returns
string The HTML hex color for the current color
|
public
string
|
#
asHex( )
Convert the internal color to hex
Convert the internal color to hex
Returns
string The hex color for the current color
|
public
array
|
#
asRgb( )
Convert the internal color to an rgb array
Convert the internal color to an rgb array
Returns
array The rgb color for the current color
|
private
array
|
#
toRgb( mixed $color, string $from = "hex" )
Convert a color from one format to rgb
Convert a color from one format to rgb
Parameters
- $color
mixed $color The color to make rgb
- $from
string $from The format to convert from
Returns
array An rgb array
|
Magic methods summary
Properties summary
private
array
|
$color |
#
A representation of the current color
A representation of the current color
|