BlueViolet
A deep, warm violet with the energy of a warm sky.
Create BlueViolet 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;
$blueviolet = Color::parse('#8A2BE2');
use PhpColor\Color\Color;
$blueviolet = Color::parse('#8A2BE2');
ColorInterface
$blueviolet
#8a2be2 · oklch(0.5338 0.2503 301.4)
Build a BlueViolet harmony
tetradic() keeps BlueViolet and adds three partners at equal quarter-turns around the OKLCH hue wheel.
<?php
$harmony = $blueviolet->tetradic();
foreach ($harmony as $color) {
echo $color->toHex().PHP_EOL;
}
$harmony = $blueviolet->tetradic();
foreach ($harmony as $color) {
echo $color->toHex().PHP_EOL;
}
- 0
#8a2be2 - 1
#d90000 - 2
#5a7d00 - 3
#0088be
Generate a BlueViolet scale
Keep the original hue and chroma, then vary OKLCH lightness to produce perceptually ordered steps.
<?php
$oklch = $blueviolet->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 = $blueviolet->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 BlueViolet for the web
The same object can emit a compact Hex value, an sRGB CSS function, or its perceptual OKLCH coordinates.
<?php
$hex = $blueviolet->toHex();
$rgb = $blueviolet->toCss('srgb');
$oklch = $blueviolet->to('oklch')->toCss();
$hex = $blueviolet->toHex();
$rgb = $blueviolet->toCss('srgb');
$oklch = $blueviolet->to('oklch')->toCss();
- hex
#8a2be2- rgb
rgb(138 43 226)- oklch
oklch(0.533765 0.250305 301.375)