Derive a light-mode palette

Transform every named dark token with one perceptual formula while keeping its key aligned.

Dark background text accent
Light background text accent
background #dedfe2
text       #131c2e
accent     #00139d

Keep the roles aligned across both themes

The returned named palette preserves background, text, and accent in the same order while transforming their perceptual lightness and chroma.

Transform the complete named palette

LightModeColorPaletteTransformer returns new color objects and coerces every palette key to a string.

<?php

use PhpColor\Color\Palette\ColorPalette;
use PhpColor\Color\Palette\Transformer\LightModeColorPaletteTransformer;

$dark = ColorPalette::parse([
    'background' => '#0b0c0e',
    'text' => '#c0cde7',
    'accent' => '#4f88fc',
]);

$light = (new LightModeColorPaletteTransformer())->transform($dark);

foreach ($light->toHex() as $name => $hex) {
    printf("%s %s\n", $name, $hex);
}

// background #dedfe2
// text #131c2e
// accent #00139d
use PhpColor\Color\Palette\ColorPalette; use PhpColor\Color\Palette\Transformer\LightModeColorPaletteTransformer; $dark = ColorPalette::parse([ 'background' => '#0b0c0e', 'text' => '#c0cde7', 'accent' => '#4f88fc', ]); $light = (new LightModeColorPaletteTransformer())->transform($dark); foreach ($light->toHex() as $name => $hex) { printf("%s %s\n", $name, $hex); } // background #dedfe2 // text #131c2e // accent #00139d

Review the result as an interface theme

The transformer applies an algorithm to colors. It does not understand token semantics or verify the contrast of the resulting role pairs.

LightnessDark values move toward a light background range; light values move toward dark text.
ChromaChromatic colors receive the configured chroma boost.
NamesRole keys and their order remain aligned.
VerificationCheck serialized foreground and background pairs before shipping the theme.

Choose a next step

Transform the palette, then verify its real role pairs