The seam blurs under 0.035 and shades by 0.10, set by eye on the ladder
SEAM_BLUR drops from 0.10 to 0.035: on a ladder of the spectrum's own pairs drawn both ways, the solid point stays findable at one cell down to a little under two noticeable differences, so the interlock is the ordinary seam and the thin chevron is for fills that are the same or as good as (a mirrored leg, a keyless run, the greens' nearest neighbours). SEAM_SHADE drops from 0.15 to 0.10: a lightness step is what a thin line is seen by, so it needs nothing like the blur distance to read, and 0.10 is a clear line that is still plainly the chip's own colour. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
ac0c86d5d3
commit
2b0f42d1cc
2 files changed
+25
-20
No files matched your search
+17
-12
@@ -266,24 +266,29 @@ def _style_hex(style: str) -> str | None:
|
||||
#: The unit is OKLab distance (:func:`~meshterm.ui.oklab.distance`), where ``0.02`` is a
|
||||
#: just-noticeable difference between two large patches and ``1`` is black to white.
|
||||
#:
|
||||
#: Calibrated against the rule it replaced — first key bytes under ``0x10`` apart on the
|
||||
#: hue wheel (JP, 2026-09-15) — which measures ``0.087`` at the median hue but ``0.026``
|
||||
#: across the greens and ``0.165`` across the cyans: the wheel is not uniform to the eye,
|
||||
#: so a hue gap blurred too little there and too much here, and an sRGB distance would
|
||||
#: only have restated the hue gap (a fixed byte step is a near-constant ``55``–``60`` of
|
||||
#: 8-bit RGB all the way round). ``0.10`` is five noticeable differences, the typical
|
||||
#: ``0x10`` pair with a little to spare, and it errs toward the thin chevron on purpose:
|
||||
#: a wrong blur still draws a legible seam, a wrong interlock draws none (JP, 2026-09-16).
|
||||
SEAM_BLUR = 0.10
|
||||
#: The rule it replaced was first key bytes under ``0x10`` apart on the hue wheel (JP,
|
||||
#: 2026-09-15), which measures ``0.087`` at the median hue but ``0.026`` across the greens
|
||||
#: and ``0.165`` across the cyans: the wheel is not uniform to the eye, so a hue gap
|
||||
#: blurred too little there and too much here, and an sRGB distance would only have
|
||||
#: restated the hue gap (a fixed byte step is a near-constant ``55``–``60`` of 8-bit RGB
|
||||
#: all the way round). The value was then set by eye on a ladder of the spectrum's own
|
||||
#: pairs drawn both ways (JP, 2026-09-16): the solid point stays findable at one cell
|
||||
#: down to a little under two noticeable differences, and below that the wedge is gone.
|
||||
#: So the interlock is the ordinary seam and the thin chevron is for fills that are the
|
||||
#: same or as good as — a mirrored leg, a keyless run, the greens' nearest neighbours
|
||||
#: (``0x10`` of green is ``0.026`` and blurs; ``0x10`` of red is ``0.124`` and doesn't).
|
||||
SEAM_BLUR = 0.035
|
||||
|
||||
#: How far the thin chevron's colour steps from the fill it is drawn in, in OKLab ``L``
|
||||
#: — a lightness shift alone, so it reads as *that chip's colour, shaded* rather than as
|
||||
#: a third colour on the line. The step is taken from the previous fill but measured from
|
||||
#: whichever of the two fills is further along (:func:`~meshterm.ui.oklab.shaded`'s
|
||||
#: ``floor``), so the mark clears the fill it actually sits on by this much even when the
|
||||
#: two differ by everything :data:`SEAM_BLUR` allows. Above the blur on its own, so the
|
||||
#: line it draws is always one the eye can find (JP, 2026-09-16).
|
||||
SEAM_SHADE = 0.15
|
||||
#: two differ by everything :data:`SEAM_BLUR` allows. A lightness step is what a thin line
|
||||
#: is seen by (the eye resolves detail in luminance, not in chroma), so it needs nothing
|
||||
#: like the blur distance to read: ``0.10`` is five noticeable differences, a clear line
|
||||
#: that is still plainly the chip's own colour, chosen on the same ladder (JP, 2026-09-16).
|
||||
SEAM_SHADE = 0.10
|
||||
|
||||
|
||||
def _fills_blur(before: str, after: str) -> bool:
|
||||
|
||||
@@ -673,7 +673,7 @@ def test_a_seam_between_two_of_one_colour_is_the_thin_chevron_shaded() -> None:
|
||||
assert glyph == POWERLINE_THIN and style == f"{_seam_ink(hue, hue)} on {hue}"
|
||||
shade = _seam_ink(hue, hue)
|
||||
assert oklab.from_hex(shade)[0] < oklab.from_hex(hue)[0] # darker…
|
||||
assert oklab.distance(shade, hue) > SEAM_BLUR # …by more than the blur, so it reads
|
||||
assert oklab.distance(shade, hue) == pytest.approx(SEAM_SHADE, abs=0.01) # …by the step
|
||||
assert oklab.distance(shade, hue) < oklab.distance(hue, _style_hex(node_style("77")))
|
||||
|
||||
assert _seams(PathHop("A", key="aa"), PathHop("B", key="77"))[0] == (
|
||||
@@ -691,22 +691,22 @@ def test_a_seam_blurs_by_perceived_distance_not_by_hue_gap() -> None:
|
||||
"""Two fills under ``SEAM_BLUR`` apart to the eye blur like an exact match.
|
||||
|
||||
The eye, not the wheel: sixteen first-byte steps across the greens are one colour to
|
||||
a reader and sixteen across the cyans are two, so the same hue gap blurs on one side
|
||||
and interlocks on the other. The greys work the same way with no exemption needed:
|
||||
the keyless grey and the faded slate sit far apart in lightness and keep their seam.
|
||||
a reader and sixteen across the reds are two, so the same hue gap blurs on one side
|
||||
of the wheel and interlocks on the other. The greys follow the same metric with no
|
||||
exemption: the keyless grey and the faded slate sit well apart and keep their seam.
|
||||
"""
|
||||
green = _seams(PathHop("A", key="4c"), PathHop("B", key="5c"))[0]
|
||||
cyan = _seams(PathHop("A", key="80"), PathHop("B", key="90"))[0]
|
||||
assert green[0] == POWERLINE_THIN and cyan[0] == POWERLINE_SEP
|
||||
red = _seams(PathHop("A", key="00"), PathHop("B", key="10"))[0]
|
||||
assert green[0] == POWERLINE_THIN and red[0] == POWERLINE_SEP
|
||||
assert oklab.distance(_style_hex(node_style("4c")), _style_hex(node_style("5c"))) < SEAM_BLUR
|
||||
assert oklab.distance(_style_hex(node_style("80")), _style_hex(node_style("90"))) > SEAM_BLUR
|
||||
assert oklab.distance(_style_hex(node_style("00")), _style_hex(node_style("10"))) > SEAM_BLUR
|
||||
|
||||
# The shade is taken from the chip behind but clears the chip ahead as well.
|
||||
before, after = _style_hex(node_style("4c")), _style_hex(node_style("5c"))
|
||||
assert green[1] == f"{_seam_ink(before, after)} on {after}"
|
||||
assert oklab.distance(_seam_ink(before, after), after) >= SEAM_SHADE - 1e-6
|
||||
|
||||
wrapped = _seams(PathHop("A", key="f8"), PathHop("B", key="04"))[0]
|
||||
wrapped = _seams(PathHop("A", key="fc"), PathHop("B", key="02"))[0]
|
||||
assert wrapped[0] == POWERLINE_THIN # neighbours across the wheel's seam, too
|
||||
|
||||
glyph, style = _seams(PathHop("A"), PathHop("B", dim=True))[0]
|
||||
|
||||
Reference in new issue
Block a user