Table of contents
Namespace: Com\Tecnick\Color\Model
class Lab extends Model
Extends: Model
Source: src/Model/Lab.php:34
CIE Lab Color Model class
Methods
__construct()
Initialize a new Lab color object.
L* is clamped to [0..100], a* and b* to [-128..127] and alpha to [0..1].
public __construct(array<string,int|float|string> $components)
Parameters:
$components(array<string,int|float|string>): Color components.
Throws:
- UnknownComponentException: if a component name is not defined by this model
Source: src/Model/Lab.php:86
getArray()
Get an array with all color components.
public getArray(): array<string,float>
Returns: array<string,float>: with keys (‘L’, ‘a’, ‘b’, ‘A’)
Source: src/Model/Lab.php:100
getComponentsString()
Get a space separated string with Lab component values.
public getComponentsString(): string
Returns: string
Source: src/Model/Lab.php:189
getCssColor()
Get the CSS representation of the color: lab(L a b) or lab(L a b / A)
Components are emitted in fixed notation with up to 4 decimals.
public getCssColor(): string
Returns: string
Source: src/Model/Lab.php:156
getJsPdfColor()
Get the color format used in Acrobat JavaScript NOTE: the alpha channel is omitted from this representation unless it is 0 = transparent
public getJsPdfColor(): string
Returns: string
Source: src/Model/Lab.php:176
getNormalizedArray()
Get an array with color components values normalized.
NOTE: the $max argument is not applied here. L* is returned in its own [0..100] range, a* and b* in [-128..127], and alpha is a fraction component kept in the [0..1] range.
public getNormalizedArray(int $max): array<string,float>
Parameters:
$max(int): Unused; kept for interface compatibility.
Returns: array<string,float>: with keys (‘L’, ‘a’, ‘b’, ‘A’)
Source: src/Model/Lab.php:141
getPDFacArray()
Get an array with all color components for the PDF appearance characteristics dictionary.
The values are in the range 0.0 to 1.0 and the number of array elements determines the color space: 3 = DeviceRGB
public getPDFacArray(): float[]
Returns: float[]: DeviceRGB color components (‘R’, ‘G’, ‘B’)
Source: src/Model/Lab.php:120
getPdfColor()
Get the color components format used in PDF documents (RGB) NOTE: the alpha channel is omitted
public getPdfColor(bool $stroke = false): string
Parameters:
$stroke(bool): True for stroking (lines, drawing) and false for non-stroking (text and area filling).
Returns: string
Source: src/Model/Lab.php:200
invertColor()
Invert the color.
public invertColor(): static
Returns: static
Source: src/Model/Lab.php:286
toCmykArray()
Get an array with CMYK color components
public toCmykArray(): array<string,float>
Returns: array<string,float>: with keys (‘cyan’, ‘magenta’, ‘yellow’, ‘key’, ‘alpha’)
Source: src/Model/Lab.php:263
toGrayArray()
Get an array with Gray color components
public toGrayArray(): array<string,float>
Returns: array<string,float>: with keys (‘gray’, ‘alpha’)
Source: src/Model/Lab.php:210
toHslArray()
Get an array with HSL color components
public toHslArray(): array<string,float>
Returns: array<string,float>: with keys (‘hue’, ‘saturation’, ’lightness’, ‘alpha’)
Source: src/Model/Lab.php:253
toLabArray()
Get an array with Lab color components
public toLabArray(): array<string,float>
Returns: array<string,float>: with keys (’lstar’, ‘astar’, ‘bstar’, ‘alpha’)
Source: src/Model/Lab.php:273
toRgbArray()
Get an array with RGB color components
public toRgbArray(): array<string,float>
Returns: array<string,float>: with keys (‘red’, ‘green’, ‘blue’, ‘alpha’)
Source: src/Model/Lab.php:220
Inherited members
From Model
- create(): Create a color model instance of the given type.
- getHexValue(): Get the normalized hexadecimal value of the specified float fraction
- getNormalizedValue(): Get the normalized integer value of the specified float fraction
- getRgbaHexColor(): Get the Hexadecimal representation of the color with alpha channel: #RRGGBBAA
- getRgbHexColor(): Get the Hexadecimal representation of the color: #RRGGBB
- getType(): Get the color model type (GRAY, RGB, HSL, CMYK, LAB)
- getTypeEnum(): Get the color model type as a backed enum case.
- withInvertedColor(): Get a copy of the color, inverted.