feat: add OKLCH-aware palette generation (#5)

* chore: update deps, fix escape codes, expand tests, add README

- Bump Go 1.18 → 1.26, simplecolorpalettes v0.9.5 → v0.9.7
- Fix swapped fg/bg ANSI escape code values in trueColorString
- Expand test suite from 2 to 13 tests (determinism, positivity, color assignment, background contrast, stringer palette)
- Add README with usage examples

* feat: add OKLCH-aware palette generation

Add GenerateOKLCHPalette() which creates n evenly-spaced colors in the
OKLCH color space at a given lightness and chroma. This produces
perceptually uniform palettes where all colors appear equally bright.

Uses the new OKLCH support from simplecolorpalettes.

Note: go.mod contains a replace directive for local development that
must be removed before merge (after simplecolorpalettes is published).

* build: update simplecolorpalettes to v0.9.8 (charmtone palette)
This commit is contained in:
2026-02-22 22:02:46 -05:00
committed by GitHub
parent e3c3a88354
commit bf06224d7a
7 changed files with 280 additions and 21 deletions

View File

@@ -101,9 +101,8 @@ func createStringerPalette(backgroundFillMode, disableSmartMode bool, c ...Color
return palette
}
// TBD not yet complete
func trueColorString(color color.Color, backgroundFillMode, disableSmartMode bool) ColorStringer {
fgEsc, bgEsc := 48, 38
fgEsc, bgEsc := 38, 48
sprint := func(args ...interface{}) string {
r, g, b, _ := color.RGBA()
if !disableSmartMode {