\Pop\Css\ColorHex

Pop CSS Hex color class

Summary

Methods
Properties
Constants
__construct()
setHex()
setR()
setG()
setB()
getHex()
getR()
getG()
getB()
isValid()
toRgb()
toHsl()
toArray()
render()
__toString()
__set()
__get()
__isset()
__unset()
offsetExists()
offsetGet()
offsetSet()
offsetUnset()
No public properties found
No constants found
No protected methods found
$r
$g
$b
$hex
N/A
No private methods found
No private properties found
N/A

Properties

$r

$r : string

R value

Type

string

$g

$g : string

G value

Type

string

$b

$b : string

B value

Type

string

$hex

$hex : string

Hex value

Type

string

Methods

__construct()

__construct(string  $hex) 

Constructor

Instantiate the CSS hex color object

Parameters

string $hex

setHex()

setHex(string  $hex) : self

Set hex value

Parameters

string $hex

Throws

\OutOfRangeException

Returns

self

setR()

setR(string  $r) : self

Set R value

Parameters

string $r

Throws

\OutOfRangeException

Returns

self

setG()

setG(string  $g) : self

Set G value

Parameters

string $g

Throws

\OutOfRangeException

Returns

self

setB()

setB(string  $b) : self

Set B value

Parameters

string $b

Throws

\OutOfRangeException

Returns

self

getHex()

getHex() : string

Get hex value

Returns

string

getR()

getR() : string

Get R value

Returns

string

getG()

getG() : string

Get G value

Returns

string

getB()

getB() : string

Get B value

Returns

string

isValid()

isValid(string  $hex) : boolean

Method to determine if the hex value is valid

Parameters

string $hex

Returns

boolean

toArray()

toArray(boolean  $assoc = true) : array

Convert to array

Parameters

boolean $assoc

Returns

array

render()

render() : string

Convert to CSS-formatted string

Returns

string

__toString()

__toString() : string

Return CSS-formatted string

Returns

string

__set()

__set(string  $name, mixed  $value) : void

Magic method to set the color value

Parameters

string $name
mixed $value

__get()

__get(string  $name) : mixed

Magic method to return the color value

Parameters

string $name

Returns

mixed

__isset()

__isset(string  $name) : boolean

Magic method to return whether the color value exists

Parameters

string $name

Returns

boolean

__unset()

__unset(string  $name) : void

Magic method to unset color value

Parameters

string $name

Throws

\Pop\Css\Color\Exception

offsetExists()

offsetExists(mixed  $offset) : boolean

ArrayAccess offsetExists

Parameters

mixed $offset

Returns

boolean

offsetGet()

offsetGet(mixed  $offset) : mixed

ArrayAccess offsetGet

Parameters

mixed $offset

Throws

\Pop\Css\Color\Exception

Returns

mixed

offsetSet()

offsetSet(mixed  $offset, mixed  $value) : void

ArrayAccess offsetSet

Parameters

mixed $offset
mixed $value

Throws

\Pop\Css\Color\Exception

offsetUnset()

offsetUnset(mixed  $offset) : void

ArrayAccess offsetUnset

Parameters

mixed $offset

Throws

\Pop\Css\Color\Exception