Files
k9s/cmd
Michael ShieldsandFernand Galiana 4edbec95cd feat: add dark/light theme inversion using Oklch (#3749)
* feat: add color inversion setting using Oklch

Add `k9s.ui.invert: true` config option and `--invert` CLI flag to
convert dark themes to light backgrounds, or vice versa.

This uses the Oklch perceptual color space with relative chroma
preservation for visually balanced results. Color processing is
done with the Colorful library, which is already an indirect
dependency.

* fix: preserve chroma during color inversion by adjusting L

Change the color inversion algorithm to preserve chroma (saturation)
at the expense of exact lightness inversion. When the ideal inverted
lightness would result in insufficient gamut space for the original
chroma, L is adjusted toward 0.5 where the sRGB gamut is larger.

This improves color differentiation after inversion. For example,
cyan and green previously both became nearly black (L≈0.10) with
minimal chroma, making them hard to distinguish. Now they invert
to L≈0.45 with preserved chroma, maintaining their visual difference.

The chromaPreserveFactor constant (0.5) controls how much original
chroma to preserve, balancing color differentiation against L fidelity.

* fix: resolve golangci-lint warnings in color code

Use lowercase variable names per Go conventions and remove
unnecessary fmt.Sprintf wrappers in test assertions.

---------

Co-authored-by: Fernand Galiana <[email protected]>
2026-01-11 10:41:03 -07:00
..
2023-12-23 14:29:55 -07:00
2023-12-23 14:29:55 -07:00
2025-04-08 23:40:34 -06:00
2025-04-08 23:40:34 -06:00