|

Palette maker

On this page, we develop strategies for building a harmonious palette, instead of picking colors at random.

Scheme palette

open full size ↗

Rather than relying on randomly chosen colors or letting users pick arbitrary ones, we develop several strategies for selecting a more harmonious palette based on relationships between colors.

We base this logic on OKLCH, as we did in the Geom project. OKLCH is one of the most perceptually accurate and computationally performant color models.

The logic takes a key hue and generates the rest of the palette (for the requested number of colors) using a specified strategy (scheme).

Schemes

Monochrome: keeps the same hue for all colors. The first sits at the hue's most vibrant point; i.e., the logic finds the lightness where the given hue reaches its highest chroma. The rest divide the available lightness range as evenly as that fixed first color allows, each at the largest chroma available.

Vivid & dark: evenly divides the color wheel, starting at the key hue. It makes the half closest to the key hue vivid, using each hue's representative lightness (see below), and makes the opposite half dark.

Pastel cluster: distributes hues clustered around the key hue and keeps all colors light and low in chroma.

Dark cluster: distributes hues clustered around the key hue (more tightly than the pastel scheme), keeping every color dark.

Vivid wheel: divides the whole color wheel evenly, and selects each hue's most vibrant point.

Black: ignores the key hue and makes every color black. This is for stroke types we want to keep strictly black: pencil, charcoal, and black inks.

Representative colors

There are colors people recognize as typical and often describe with the simplest color terms (e.g., red, green, blue, pink). These colors have a particular lightness at which they look most typical, and that lightness often differs from the lightness where the hue's chroma peaks. For example, yellow looks yellow only when it's bright, while green and blue look most recognizable well below their chroma peaks.

Vivid & dark uses this lightness, anchored by color term (red 0.58, yellow 0.90, yellow-green 0.82, green 0.50, blue 0.45, pink 0.78) and interpolated around the wheel. These values are set arbitrarily by the author, not scientifically; these prototypes are cultural, and where the colors sit depends on who you ask.

Randomness

Every scheme except Black jitters the hue and lightness of the colors other than the key color. The palette sets a random seed, and the jitter is derived from that seed, so the same settings reproduce the same palette.

The class is documented on Palette.