Pi's system theme derives color from your terminal and contrast requirements

The theme adapts to a user's terminal palette without blindly reusing colors that may be unreadable: it separates hue/chroma from lightness, then derives role-specific lightness from contrast constraints.

Logged at IST: 2026-10-09 09:58 IST

What it is: Maximilian Blazek explains how Pi's new default system theme adapts to the user's terminal colors while preserving readable contrast.

Gist: Pi treats the terminal's palette as a source of hue and chroma, not as a finished UI theme. It converts colors into perceptual OKLCH space, then computes each UI role's lightness from explicit constraints describing which foregrounds and panels need to contrast with which backgrounds. The implementation reverses a perceptual contrast algorithm and uses fitted polynomial coefficients, avoiding shipping the reference algorithm itself. At startup Pi asks the terminal for its colors and regenerates the theme, including when the terminal switches between light and dark. The article also explains why ANSI palettes are inconsistent and why simply reusing them can make complex terminal interfaces inaccessible.

Why it matters: A practical design pattern for personalization without surrendering legibility: inherit the user's color identity, but derive accessible role colors from the interface's contrast relationships. The author also calls out that contrast is perceptual and invites users to contribute data to an open survey.

Caveat: Contrast thresholds are an engineering approximation of perception; the article notes there is no open dataset that fully captures how real people perceive contrast on real screens.

Embedded source: X post