Hex
extends AbstractColor
in package
implements
ArrayAccess
Pop Color Hex color class
Tags
Table of Contents
Interfaces
- ArrayAccess
Constants
Properties
- $b : string|null
- B value
- $g : string|null
- G value
- $hex : string|null
- Hex value
- $r : string|null
- R value
Methods
- __construct() : mixed
- Constructor
- __get() : mixed
- Magic method to return the color value
- __isset() : bool
- Magic method to return whether the color value exists
- __set() : void
- Magic method to set the color value
- __toString() : string
- Return CSS-formatted string
- __unset() : void
- Magic method to unset color value
- getB() : string|null
- Get B value
- getG() : string|null
- Get G value
- getHex() : string
- Get hex value
- getR() : string|null
- Get R value
- isValid() : bool
- Method to determine if the hex value is valid
- offsetExists() : bool
- ArrayAccess offsetExists
- offsetGet() : mixed
- ArrayAccess offsetGet
- offsetSet() : void
- ArrayAccess offsetSet
- offsetUnset() : void
- ArrayAccess offsetUnset
- render() : string
- Convert to readable string
- setB() : self
- Set B value
- setG() : self
- Set G value
- setHex() : self
- Set hex value
- setR() : self
- Set R value
- toArray() : array<string|int, mixed>
- Convert to array
- toHsl() : Hsl
- Convert to HSL
- toRgb() : Rgb
- Convert to RGB
Constants
COMMA
String formats
public
mixed
COMMA
= 'COMMA'
CSS
public
mixed
CSS
= 'CSS'
PERCENT
public
mixed
PERCENT
= 'PERCENT'
Properties
$b
B value
protected
string|null
$b
= null
$g
G value
protected
string|null
$g
= null
$hex
Hex value
protected
string|null
$hex
= null
$r
R value
protected
string|null
$r
= null
Methods
__construct()
Constructor
public
__construct(string $hex) : mixed
Instantiate the CSS hex color object
Parameters
- $hex : string
__get()
Magic method to return the color value
public
__get(string $name) : mixed
Parameters
- $name : string
Tags
__isset()
Magic method to return whether the color value exists
public
__isset(string $name) : bool
Parameters
- $name : string
Return values
bool__set()
Magic method to set the color value
public
__set(string $name, mixed $value) : void
Parameters
- $name : string
- $value : mixed
Tags
__toString()
Return CSS-formatted string
public
__toString() : string
Return values
string__unset()
Magic method to unset color value
public
__unset(string $name) : void
Parameters
- $name : string
Tags
getB()
Get B value
public
getB() : string|null
Return values
string|nullgetG()
Get G value
public
getG() : string|null
Return values
string|nullgetHex()
Get hex value
public
getHex() : string
Return values
stringgetR()
Get R value
public
getR() : string|null
Return values
string|nullisValid()
Method to determine if the hex value is valid
public
isValid(string $hex) : bool
Parameters
- $hex : string
Return values
booloffsetExists()
ArrayAccess offsetExists
public
offsetExists(mixed $offset) : bool
Parameters
- $offset : mixed
Return values
booloffsetGet()
ArrayAccess offsetGet
public
offsetGet(mixed $offset) : mixed
Parameters
- $offset : mixed
Tags
offsetSet()
ArrayAccess offsetSet
public
offsetSet(mixed $offset, mixed $value) : void
Parameters
- $offset : mixed
- $value : mixed
Tags
offsetUnset()
ArrayAccess offsetUnset
public
offsetUnset(mixed $offset) : void
Parameters
- $offset : mixed
Tags
render()
Convert to readable string
public
render([string|null $format = null ]) : string
Parameters
- $format : string|null = null
Return values
stringsetB()
Set B value
public
setB(string $b) : self
Parameters
- $b : string
Tags
Return values
selfsetG()
Set G value
public
setG(string $g) : self
Parameters
- $g : string
Tags
Return values
selfsetHex()
Set hex value
public
setHex(string $hex) : self
Parameters
- $hex : string
Tags
Return values
selfsetR()
Set R value
public
setR(string $r) : self
Parameters
- $r : string
Tags
Return values
selftoArray()
Convert to array
public
toArray([bool $assoc = true ]) : array<string|int, mixed>
Parameters
- $assoc : bool = true
Return values
array<string|int, mixed>toHsl()
Convert to HSL
public
toHsl() : Hsl
Return values
HsltoRgb()
Convert to RGB
public
toRgb() : Rgb