Oklch
extends AbstractColor
in package
Pop Color Oklch color class
Tags
Table of Contents
Constants
Properties
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
- getAlpha() : float|null
- Get alpha value
- getC() : float
- Get C value
- getH() : int
- Get H value
- getL() : float
- Get L value
- hasAlpha() : bool
- Determine if the color object has an alpha value
- offsetExists() : bool
- ArrayAccess offsetExists
- offsetGet() : mixed
- ArrayAccess offsetGet
- offsetSet() : void
- ArrayAccess offsetSet
- offsetUnset() : void
- ArrayAccess offsetUnset
- render() : string
- Convert to readable string
- setAlpha() : self
- Set alpha value
- setC() : self
- Set C value
- setH() : self
- Set H value
- setL() : self
- Set L value
- toArray() : array<string|int, mixed>
- Convert to array
- toCss() : string
- Convert to a CSS-formatted string, regardless of the class's default __toString() format
- toOklab() : Oklab
- Convert to Oklab
- toRgb() : Rgb
- Convert to RGB
- channels() : array<string|int, mixed>
- Get the valid channel names
- channelsForError() : string
- Format the valid channel names for an exception message, e.g. "'r', 'g', 'b' or 'a'"
Constants
COMMA
String formats
public
mixed
COMMA
= 'COMMA'
CSS
public
mixed
CSS
= 'CSS'
PERCENT
public
mixed
PERCENT
= 'PERCENT'
Properties
$alpha
Alpha value
protected
float|null
$alpha
= null
$c
C value
protected
float
$c
= 0
$h
H value
protected
int
$h
= 0
$l
L value
protected
float
$l
= 0
Methods
__construct()
Constructor
public
__construct(float|string $l, float|string $c, int|string $h[, float|string|null $alpha = null ]) : mixed
Instantiate the Oklch color object
Parameters
- $l : float|string
- $c : float|string
- $h : int|string
- $alpha : float|string|null = null
__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
getAlpha()
Get alpha value
public
getAlpha() : float|null
Return values
float|nullgetC()
Get C value
public
getC() : float
Return values
floatgetH()
Get H value
public
getH() : int
Return values
intgetL()
Get L value
public
getL() : float
Return values
floathasAlpha()
Determine if the color object has an alpha value
public
hasAlpha() : bool
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
stringsetAlpha()
Set alpha value
public
setAlpha(float|string $alpha) : self
Parameters
- $alpha : float|string
Tags
Return values
selfsetC()
Set C value
public
setC(float|string $c) : self
Parameters
- $c : float|string
Tags
Return values
selfsetH()
Set H value
public
setH(int|string $h) : self
Parameters
- $h : int|string
Tags
Return values
selfsetL()
Set L value
public
setL(float|string $l) : self
Parameters
- $l : float|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>toCss()
Convert to a CSS-formatted string, regardless of the class's default __toString() format
public
toCss() : string
Return values
stringtoOklab()
Convert to Oklab
public
toOklab() : Oklab
Return values
OklabtoRgb()
Convert to RGB
public
toRgb() : Rgb
Return values
Rgbchannels()
Get the valid channel names
protected
channels() : array<string|int, mixed>
Return values
array<string|int, mixed>channelsForError()
Format the valid channel names for an exception message, e.g. "'r', 'g', 'b' or 'a'"
protected
channelsForError() : string