Canary
A pastel lime with the freshness of a spring lime.
Create Canary 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;
$canary = Color::parse('#FFFFED');
use PhpColor\Color\Color;
$canary = Color::parse('#FFFFED');
ColorInterface
$canary
#ffffed · oklch(0.9952 0.0235 106.8)
Tint Canary for a system
Canary is a neutral, so rotating its hue changes nothing. Design systems rarely ship a pure neutral either: give it a trace of chroma and it belongs to the palette around it.
<?php
$neutral = $canary->to('oklch');
foreach (['warm' => 60, 'fresh' => 150, 'cool' => 250] as $name => $hue) {
echo $neutral->withChannel('c', 0.02)->withChannel('h', $hue)->toHex().PHP_EOL;
}
$neutral = $canary->to('oklch');
foreach (['warm' => 60, 'fresh' => 150, 'cool' => 250] as $name => $hue) {
echo $neutral->withChannel('c', 0.02)->withChannel('h', $hue)->toHex().PHP_EOL;
}
- Warm
#fffbf0 - Fresh
#f5fff7 - Cool
#f4ffff
Generate a Canary scale
Keep the original hue and chroma, then vary OKLCH lightness to produce perceptually ordered steps.
<?php
$oklch = $canary->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 = $canary->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 Canary for the web
The same object can emit a compact Hex value, an sRGB CSS function, or its perceptual OKLCH coordinates.
<?php
$hex = $canary->toHex();
$rgb = $canary->toCss('srgb');
$oklch = $canary->to('oklch')->toCss();
$hex = $canary->toHex();
$rgb = $canary->toCss('srgb');
$oklch = $canary->to('oklch')->toCss();
- hex
#ffffed- rgb
rgb(255 255 237)- oklch
oklch(0.995207 0.0235103 106.819)