Midnight

A dark, warm indigo with the energy of a warm sky.

Hex
#1e1b4b
sRGB
rgb(30 27 75)
OKLCH
oklch(0.2573 0.0861 281.3)

Midnight is a curated PHPColor catalog color with the canonical value #1e1b4b.

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

$midnight = Color::parse('#1E1B4B');
use PhpColor\Color\Color; $midnight = Color::parse('#1E1B4B');

ColorInterface

$midnight

#1e1b4b · oklch(0.2573 0.0861 281.3)

Build a Midnight harmony

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

<?php

$harmony = $midnight->tetradic();

foreach ($harmony as $color) {
    echo $color->toHex().PHP_EOL;
}
$harmony = $midnight->tetradic(); foreach ($harmony as $color) { echo $color->toHex().PHP_EOL; }
  1. 0#1e1b4b
  2. 1#430a19
  3. 2#2d2300
  4. 3#002f2d
Midnight and its three generated partners

Generate a Midnight scale

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

<?php

$oklch = $midnight->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 = $midnight->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 named color scales →

Format Midnight for the web

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

<?php

$hex   = $midnight->toHex();
$rgb   = $midnight->toCss('srgb');
$oklch = $midnight->to('oklch')->toCss();
$hex = $midnight->toHex(); $rgb = $midnight->toCss('srgb'); $oklch = $midnight->to('oklch')->toCss();
hex
#1e1b4b
rgb
rgb(30 27 75)
oklch
oklch(0.257333 0.086068 281.288)

Keep exploring

Continue from Midnight