Skip to content

values: derive the named-colour views from one table - #289

Merged
samoht merged 3 commits into
mainfrom
values-color-tables
Aug 2, 2026
Merged

values: derive the named-colour views from one table#289
samoht merged 3 commits into
mainfrom
values-color-tables

Conversation

@samoht

@samoht samoht commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Five hand-maintained named-colour tables had drifted twice over: named_for_hex was a hand-copied subset missing exactly the seven colours whose name is shorter than their hex (bisque, indigo, orchid, salmon, sienna, tomato, violet - the minifier never took those folds), and read_color_name accepted 21 of 148 names, mapping grey to Gray. One (constructor, name, hex) table now derives all five views, with a not-called exhaustive match making a new color_name constructor a build error beside the table, and the shortest-spelling predicate written once and read by both the fold and its inversion. A 444-declaration sweep confirms exactly the seven spellings changed. Separately, the lossless canonical projection keys an exact color(srgb 1 0 0) onto rgb(255,0,0) - same colour, different function - closing a projection gap; display-p3 and inexact channels stay distinct.

@samoht
samoht force-pushed the values-color-tables branch from d728b35 to 8970454 Compare August 2, 2026 05:15
samoht added 3 commits August 1, 2026 22:34
The seven six-letter names never fold back from their six-digit hex, grey
reads as Gray, and read_color_name takes 21 of the 148 names pp_color_name
prints. Under --lossless the canonical projection also reads
color(srgb 1 0 0) and rgb(255 0 0) as a difference.
The five hand-maintained tables had drifted: the hex inversion was a copied
subset missing the seven colours whose name is no longer than their hex, so
#ffe4c4 stayed hex where #f0ffff folded to azure, and read_color_name took 21
of the 148 names and mapped grey onto Gray. One (constructor, name, hex) list
now feeds all five, with the name-versus-hex length rule written once and
canonical_color_of_hex returning the constructor instead of re-parsing a name.
--lossless keeps whichever colour function the author wrote, so the canonical
projection read color(srgb 1 0 0) and rgb(255 0 0) as a difference when they
are one colour in two spellings. The projection now folds a color(srgb ...)
whose channels land on whole bytes; the fold is exact-only, and a declaration
is left as it came in unless the colour actually moved, so emission is
untouched and display-p3 red stays a difference.
@samoht
samoht force-pushed the values-color-tables branch from 8970454 to 88c2e6b Compare August 2, 2026 05:36
@samoht
samoht merged commit b11a950 into main Aug 2, 2026
5 checks passed
@samoht
samoht deleted the values-color-tables branch August 2, 2026 05:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant