Onyx
A dark, cool cyan -- the dependable foundation of trustworthy interfaces.
Create Onyx 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;
$onyx = Color::parse('#353839');
use PhpColor\Color\Color;
$onyx = Color::parse('#353839');
ColorInterface
$onyx
#353839 · oklch(0.3382 0.0045 219.6)
Tint Onyx for a system
Onyx 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 = $onyx->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 = $onyx->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
#3f352d - Fresh
#303b32 - Cool
#303842
Generate an Onyx scale
Keep the original hue and chroma, then vary OKLCH lightness to produce perceptually ordered steps.
<?php
$oklch = $onyx->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 = $onyx->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 Onyx for the web
The same object can emit a compact Hex value, an sRGB CSS function, or its perceptual OKLCH coordinates.
<?php
$hex = $onyx->toHex();
$rgb = $onyx->toCss('srgb');
$oklch = $onyx->to('oklch')->toCss();
$hex = $onyx->toHex();
$rgb = $onyx->toCss('srgb');
$oklch = $onyx->to('oklch')->toCss();
- hex
#353839- rgb
rgb(53 56 57)- oklch
oklch(0.338159 0.00449162 219.61)