LchColor
Represents a color in the CIELCH color space.
CIELCH (or Lch) is a cylindrical representation of the CIELAB color space,
using lightness (L), chroma (C), and hue (H).
Methods
public function blend(ColorInterface|string $backdrop, string $mode): static
Parameters
| Name | Type | Default |
|---|---|---|
$backdrop |
ColorInterface|string | - |
$mode |
string | "normal" |
public function complementary(): static
public function desaturate(float $amount): static
Parameters
| Name | Type | Default |
|---|---|---|
$amount |
float | - |
public function equals(ColorInterface $other): bool
Parameters
| Name | Type | Default |
|---|---|---|
$other |
ColorInterface | - |
from
static
public static function from(ColorInterface|string $input): static
Parameters
| Name | Type | Default |
|---|---|---|
$input |
ColorInterface|string | - |
fromChannels
static
public static function fromChannels(array $channels, float $alpha): static
Create color from channel values.
Parameters
| Name | Type | Default |
|---|---|---|
$channels |
array | - |
$alpha |
float | 1 |
fromLab
static
public static function fromLab(LabColor $lab): static
Create an Lch color from a Lab color instance.
Parameters
| Name | Type | Default |
|---|---|---|
$lab |
LabColor | - |
fromSrgb
static
public static function fromSrgb(SrgbColor $srgb): static
Parameters
| Name | Type | Default |
|---|---|---|
$srgb |
SrgbColor | - |
public function getAlpha(): float
public function getChannels(): array
public function getHue(): float
public function getLuminance(): float
public function getOpacity(): float
public function getSaturation(): float
getSpaceName
static
public static function getSpaceName(): string
public function grayscale(): static
public function invert(): static
public function isCold(): bool
public function isDark(): bool
public function isHot(): bool
public function isLight(): bool
public function isOpaque(): bool
public function isTransparent(): bool
parse
static
public static function parse(string $color): static
Parse an lch() color string into an Lch color instance.
Parameters
| Name | Type | Default |
|---|---|---|
$color |
string | - |
public function rotateHue(float $degrees): static
Parameters
| Name | Type | Default |
|---|---|---|
$degrees |
float | - |
public function splitComplementary(): array
public function temperature(): float
public function tetradic(): array
public function to(ColorInterface|string $space): ColorInterface
Parameters
| Name | Type | Default |
|---|---|---|
$space |
ColorInterface|string | - |
public function toHex(bool $withAlpha): string
Parameters
| Name | Type | Default |
|---|---|---|
$withAlpha |
bool | false |
public function toOklch(): OklchColor
public function toSrgb(): SrgbColor
public function toString(): string
public function triadic(): array
tryFrom
static
public static function tryFrom(ColorInterface|string $input): static
Parameters
| Name | Type | Default |
|---|---|---|
$input |
ColorInterface|string | - |
public function withChannel(string $name, int|float $value): static
Parameters
| Name | Type | Default |
|---|---|---|
$name |
string | - |
$value |
int|float | - |
public function withChannels(array $partial): static
Parameters
| Name | Type | Default |
|---|---|---|
$partial |
array | - |