Gray
A mid yellow with the freshness of a spring yellow.
Create Gray 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;
$gray = Color::parse('#808080');
use PhpColor\Color\Color;
$gray = Color::parse('#808080');
ColorInterface
$gray
#808080 · oklch(0.5999 0.0000 89.9)
Tint Gray for a system
Gray 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 = $gray->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 = $gray->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
#8a7e74 - Fresh
#78847a - Cool
#77818c
Generate a Gray scale
Keep the original hue and chroma, then vary OKLCH lightness to produce perceptually ordered steps.
<?php
$oklch = $gray->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 = $gray->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 Gray for the web
The same object can emit a compact Hex value, an sRGB CSS function, or its perceptual OKLCH coordinates.
<?php
$hex = $gray->toHex();
$rgb = $gray->toCss('srgb');
$oklch = $gray->to('oklch')->toCss();
$hex = $gray->toHex();
$rgb = $gray->toCss('srgb');
$oklch = $gray->to('oklch')->toCss();
- hex
#808080- rgb
rgb(128 128 128)- oklch
oklch(0.599871 0 89.8756)