LinearSrgbColor

Linear sRGB color value object.

This class represents the linear-light version of sRGB, storing linearized
RGB channels in the range [0, 1].

Methods

public function analogous(int $count): array
Parameters
NameTypeDefault
$count int 2
public function blend(ColorInterface|string $backdrop, string $mode): static
Parameters
NameTypeDefault
$backdrop ColorInterface|string -
$mode string "normal"
public function complementary(): static
public function cool(float $amount): static
Parameters
NameTypeDefault
$amount float -
public function darken(float $amount): static
Parameters
NameTypeDefault
$amount float -
public function desaturate(float $amount): static
Parameters
NameTypeDefault
$amount float -
public function equals(ColorInterface $other): bool
Parameters
NameTypeDefault
$other ColorInterface -

from

static
public static function from(ColorInterface|string $input): static
Parameters
NameTypeDefault
$input ColorInterface|string -

fromChannels

static
public static function fromChannels(array $channels, float $alpha): static

Create color from channel values.

Parameters
NameTypeDefault
$channels array -
$alpha float 1

fromSrgb

static
public static function fromSrgb(SrgbColor $srgb): static
Parameters
NameTypeDefault
$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
public function lighten(float $amount): static
Parameters
NameTypeDefault
$amount float -
public function rotateHue(float $degrees): static
Parameters
NameTypeDefault
$degrees float -
public function saturate(float $amount): static
Parameters
NameTypeDefault
$amount float -
public function shade(float $t): static
Parameters
NameTypeDefault
$t float -
public function splitComplementary(): array
public function temperature(): float
public function tetradic(): array
public function tint(float $t): static
Parameters
NameTypeDefault
$t float -

to

public function to(ColorInterface|string $space): ColorInterface
Parameters
NameTypeDefault
$space ColorInterface|string -
public function toCss(string $space): string
Parameters
NameTypeDefault
$space string null
public function toHex(bool $withAlpha): string
Parameters
NameTypeDefault
$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
NameTypeDefault
$input ColorInterface|string -
public function warm(float $amount): static
Parameters
NameTypeDefault
$amount float -
public function withAlpha(float $alpha): static
Parameters
NameTypeDefault
$alpha float 1
public function withChannel(string $name, int|float $value): static
Parameters
NameTypeDefault
$name string -
$value int|float -
public function withChannels(array $partial): static
Parameters
NameTypeDefault
$partial array -