Blue

A deep, cool indigo -- the dependable foundation of trustworthy interfaces.

Hex
#0000ff
sRGB
rgb(0 0 255)
OKLCH
oklch(0.4520 0.3132 264.1)

Blue is a standard CSS named color with the canonical value #0000ff.

Create Blue 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;

$blue = Color::parse('#0000FF');
use PhpColor\Color\Color; $blue = Color::parse('#0000FF');

ColorInterface

$blue

#0000ff · oklch(0.4520 0.3132 264.1)

Build a Blue harmony

tetradic() keeps Blue and adds three partners at equal quarter-turns around the OKLCH hue wheel.

<?php

$harmony = $blue->tetradic();

foreach ($harmony as $color) {
    echo $color->toHex().PHP_EOL;
}
$harmony = $blue->tetradic(); foreach ($harmony as $color) { echo $color->toHex().PHP_EOL; }
  1. 0#0000ff
  2. 1#c00061
  3. 2#a02000
  4. 3#008048
Blue and its three generated partners

Generate a Blue scale

Keep the original hue and chroma, then vary OKLCH lightness to produce perceptually ordered steps.

<?php

$oklch = $blue->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 = $blue->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
Explore the complete Blue scale →

Format Blue for the web

The same object can emit a compact Hex value, an sRGB CSS function, or its perceptual OKLCH coordinates.

<?php

$hex   = $blue->toHex();
$rgb   = $blue->toCss('srgb');
$oklch = $blue->to('oklch')->toCss();
$hex = $blue->toHex(); $rgb = $blue->toCss('srgb'); $oklch = $blue->to('oklch')->toCss();
hex
#0000ff
rgb
rgb(0 0 255)
oklch
oklch(0.452014 0.313214 264.052)

Keep exploring

Continue from Blue