Lavender
A light, warm violet with the energy of a warm sky.
Create Lavender in PHP
Parse the catalog’s canonical value once, then keep the resulting color object throughout the rest of your code.
<?php
use PhpColor\Color\Color;
$lavender = Color::parse('#A78BFA');
use PhpColor\Color\Color;
$lavender = Color::parse('#A78BFA');
ColorInterface
$lavender
#a78bfa · oklch(0.7090 0.1592 293.5)
Build a Lavender harmony
tetradic() keeps Lavender and adds three partners at equal quarter-turns around the OKLCH hue wheel.
<?php
$harmony = $lavender->tetradic();
foreach ($harmony as $color) {
echo $color->toHex().PHP_EOL;
}
$harmony = $lavender->tetradic();
foreach ($harmony as $color) {
echo $color->toHex().PHP_EOL;
}
- 0
#a78bfa - 1
#f47470 - 2
#a2ab00 - 3
#00bcce
Generate a Lavender scale
Keep the original hue and chroma, then vary OKLCH lightness to produce perceptually ordered steps.
<?php
$oklch = $lavender->to('oklch');
foreach ([0.97, 0.92, 0.84, 0.74, 0.66, 0.58, 0.48, 0.40, 0.32, 0.24, 0.16] as $lightness) {
$step = $oklch->withChannel('l', $lightness);
}
$oklch = $lavender->to('oklch');
foreach ([0.97, 0.92, 0.84, 0.74, 0.66, 0.58, 0.48, 0.40, 0.32, 0.24, 0.16] as $lightness) {
$step = $oklch->withChannel('l', $lightness);
}
50
100
200
300
400
500
600
700
800
900
950
Format Lavender for the web
The same object can emit a compact Hex value, an sRGB CSS function, or its perceptual OKLCH coordinates.
<?php
$hex = $lavender->toHex();
$rgb = $lavender->toCss('srgb');
$oklch = $lavender->to('oklch')->toCss();
$hex = $lavender->toHex();
$rgb = $lavender->toCss('srgb');
$oklch = $lavender->to('oklch')->toCss();
- hex
#a78bfa- rgb
rgb(167 139 250)- oklch
oklch(0.708969 0.159168 293.541)