Node hues share one OKLab lightness, so every name and chip reads alike
The spectrum was an HSV wheel at one saturation and value, which is not one lightness to the eye: blue names sat at OKLab L 0.55 and yellow at 0.93. A chip's fill is its label at CHIP_LIGHTNESS of that lightness, so chip contrast followed the label, from APCA Lc 19 on blue to 64 on yellow. Each byte now keeps its HSV hue angle and chroma at OKLab L 0.72, with the chroma fitted where the gamut cannot hold it. JP chose 0.72 on a ladder of wheels from 0.70 to 0.85. Every name reads equally light and every chip lands at Lc 34 to 41. The 256 colours are written out as _NODE_SPECTRUM, because computing them costs about 14 ms here and _IDENTITY_STYLES needs all of them at import, which would slow every start on the handhelds. A test holds the table to _spectrum_hex, and checks one lightness, 256 distinct hues, no console-slot collision, and that each hue angle is kept. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
f296413a5e
commit
598e53b488
5 files changed
+147
-18
No files matched your search
+5
-2
@@ -35,7 +35,7 @@ def test_the_wheel_is_not_uniform_to_the_eye() -> None:
|
||||
"""One hue step is small in green and large in cyan. This is why the module exists."""
|
||||
green = oklab.distance(_fill("4c"), _fill("5c"))
|
||||
cyan = oklab.distance(_fill("80"), _fill("90"))
|
||||
assert green < 0.03 < 0.15 < cyan
|
||||
assert green < 0.03 < 0.08 < cyan # also on the spectrum of one lightness (2026-10-29)
|
||||
|
||||
|
||||
def test_shaded_moves_lightness_alone_away_from_the_nearer_end() -> None:
|
||||
@@ -66,10 +66,13 @@ def test_fitted_lowers_chroma_alone_and_keeps_near_hues_apart() -> None:
|
||||
|
||||
A colour in the gamut is returned unchanged. The clip in ``to_hex`` made two dark
|
||||
greens near ``0x50`` almost one colour. After the fit, they are clearly two colours.
|
||||
The two greens are ``0x4c`` and ``0x5c`` of the HSV wheel that the spectrum used before
|
||||
2026-10-29. The spectrum of one lightness has less chroma in the greens, so its own
|
||||
greens leave the gamut less when they are darker.
|
||||
"""
|
||||
inside = oklab.from_hex(_fill("80"))
|
||||
assert oklab.fitted(inside) == inside
|
||||
darker = [oklab.from_hex(_fill(key)) for key in ("4c", "5c")]
|
||||
darker = [oklab.from_hex(green) for green in ("#77f255", "#55f26d")]
|
||||
outside = [(lab[0] * 0.6, lab[1], lab[2]) for lab in darker]
|
||||
fits = [oklab.fitted(lab) for lab in outside]
|
||||
clipped = oklab.distance(*(oklab.to_hex(lab) for lab in outside))
|
||||
|
||||
Reference in new issue
Block a user