Documentation

Hsl extends AbstractColor
in package
implements ArrayAccess

Pop Color HSL color class

Tags
category

Pop

author

Nick Sagona, III dev@nolainteractive.com

copyright

Copyright (c) 2009-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com)

license

http://www.popphp.org/license New BSD License

version
1.0.0

Table of Contents

Interfaces

ArrayAccess

Constants

COMMA  = 'COMMA'
String formats
CSS  = 'CSS'
PERCENT  = 'PERCENT'

Properties

$a  : float|null
Alpha value
$h  : int
H value
$l  : int
L value
$s  : int
S 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
getA()  : float|null
Get A value
getH()  : int
Get H value
getL()  : int
Get L value
getS()  : int
Get S value
hasA()  : bool
Determine if the color object has an alpha value
hasAlpha()  : bool
Determine if the color object has an alpha value (alias)
offsetExists()  : bool
ArrayAccess offsetExists
offsetGet()  : mixed
ArrayAccess offsetGet
offsetSet()  : void
ArrayAccess offsetSet
offsetUnset()  : void
ArrayAccess offsetUnset
render()  : string
Convert to readable string
setA()  : self
Set A value
setH()  : self
Set H value
setL()  : self
Set L value
setS()  : self
Set S value
toArray()  : array<string|int, mixed>
Convert to array
toHex()  : Hex
Convert to hex
toRgb()  : Rgb
Convert to RGB

Constants

Properties

$a

Alpha value

protected float|null $a = null

$h

H value

protected int $h = 0

$l

L value

protected int $l = 0

$s

S value

protected int $s = 0

Methods

__construct()

Constructor

public __construct(int|string $h, int|string $s, int|string $l[, float|string|null $a = null ]) : mixed

Instantiate the CSS HSL color object

Parameters
$h : int|string
$s : int|string
$l : int|string
$a : float|string|null = null

__get()

Magic method to return the color value

public __get(string $name) : mixed
Parameters
$name : string
Tags
throws
Exception

__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
throws
Exception

__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
throws
Exception

getA()

Get A value

public getA() : float|null
Return values
float|null

getH()

Get H value

public getH() : int
Return values
int

getL()

Get L value

public getL() : int
Return values
int

getS()

Get S value

public getS() : int
Return values
int

hasA()

Determine if the color object has an alpha value

public hasA() : bool
Return values
bool

hasAlpha()

Determine if the color object has an alpha value (alias)

public hasAlpha() : bool
Return values
bool

offsetExists()

ArrayAccess offsetExists

public offsetExists(mixed $offset) : bool
Parameters
$offset : mixed
Return values
bool

offsetGet()

ArrayAccess offsetGet

public offsetGet(mixed $offset) : mixed
Parameters
$offset : mixed
Tags
throws
Exception

offsetSet()

ArrayAccess offsetSet

public offsetSet(mixed $offset, mixed $value) : void
Parameters
$offset : mixed
$value : mixed
Tags
throws
Exception

offsetUnset()

ArrayAccess offsetUnset

public offsetUnset(mixed $offset) : void
Parameters
$offset : mixed
Tags
throws
Exception

render()

Convert to readable string

public render([string|null $format = null ]) : string
Parameters
$format : string|null = null
Return values
string

setA()

Set A value

public setA(float|string $a) : self
Parameters
$a : float|string
Tags
throws
OutOfRangeException
Return values
self

setH()

Set H value

public setH(int|string $h) : self
Parameters
$h : int|string
Tags
throws
OutOfRangeException
Return values
self

setL()

Set L value

public setL(int|string $l) : self
Parameters
$l : int|string
Tags
throws
OutOfRangeException
Return values
self

setS()

Set S value

public setS(int|string $s) : self
Parameters
$s : int|string
Tags
throws
OutOfRangeException
Return values
self

toArray()

Convert to array

public toArray([bool $assoc = true ]) : array<string|int, mixed>
Parameters
$assoc : bool = true
Return values
array<string|int, mixed>

toHex()

Convert to hex

public toHex() : Hex
Return values
Hex

toRgb()

Convert to RGB

public toRgb() : Rgb
Return values
Rgb

        
On this page

Search results