Repository navigation
feat: color-encoding tiers derived from capability evidence - #148
Merged
Merged
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
|
Size Increased — +1.4 KB 143.7 KB unpacked |
commit: |
natemoo-re
force-pushed
the
feat/color-encoding-modes
branch
from
October 12, 2026 01:17
262c219 to
23559ee
Compare
This was referenced Oct 15, 2026
natemoo-re
force-pushed
the
feat/color-encoding-modes
branch
2 times, most recently
from
December 3, 2026 03:16
9295b93 to
8c59cff
Compare
natemoo-re
marked this pull request as ready for review
December 3, 2026 03:22
The renderer resolves an emission tier (truecolor / 256 / 16) from its capability snapshot instead of hardcoding 24-bit truecolor, per specs/color-encoding-spec.md. Capability state is authoritative in the WASM instance; the host pushes it at creation and after capability folds, and a tier change forces a complete redraw. Standard palette colors keep their classic indices when downmapped. Terminal-themed colors from the system-color work bypass downmapping: -ansi-* palette colors are already 4-bit and emit unchanged in every tier, while a cross-field Canvas/CanvasText resolved from the probed theme is ordinary sRGB and is encoded for the active tier. Closes #60
natemoo-re
force-pushed
the
feat/color-encoding-modes
branch
from
December 3, 2026 13:50
63c2837 to
2264f65
Compare
cowboyd
reviewed
Dec 3, 2026
cowboyd
left a comment
Collaborator
There was a problem hiding this comment.
Just a few comments on keeping the specs from getting too big, and also about where to keep current and previous state.
Drop the architecture diagram, WASM state-ownership notes, test plan, rejected-alternative discussion, and deferred-work list; keep tier resolution, emission formats, downmapping, and tier-change output. Sections renumber accordingly (resolution §5, formats §6, downmapping §7, tier changes §8). renderer-spec §7.8 no longer references follow-up PR sequencing.
The emitted tier is per-frame output state, like pointer_shape, so it lives on Frame instead of the Clayterm instance. write_current_frame resolves current->color_tier and compares it against previous's to decide on a full redraw; the frame swap carries it forward, so the separate last_tier sentinel goes away. Also repoints code comments at the renumbered spec sections.
Since #157/#158, a cell's color is known only after render-time field resolution (inheritance, currentcolor, system colors). The tier now applies explicitly to that resolved color; terminal default and palette colors defer to renderer-spec §8.5 instead of restating it, which also drops a "no color SGR" rule that contradicted §8.5's allowance of SGR 39/49. renderer-spec's "unchanged cell MUST NOT be re-emitted" gains the CI-5 tier-change exception, and §7.1 notes that `red` downmaps while `-ansi-red` is palette 1 in every tier.
An inherited open() color and a currentcolor background that resolve to sRGB downmap like any other sRGB color. The default-color test now asserts tier-independent bytes rather than the absence of any color SGR, matching CI-6.
An sRGB color is a fixed color, but mapping #ff0000 to palette index 1 made its appearance depend on the user's theme: a terminal that sets index 1 to pink rendered `red` pink in 256-color output and red in truecolor. #60 asked for `\x1b[38;5;1m` before the `-ansi-*` keywords existed; now that they do, they are the way to ask for the theme's colors. The 256 tier maps only onto the cube and grayscale ramp (16-255), so standard red emits 196. CI-4 becomes "every cube and ramp color maps to its own index". The 16 tier keeps nearest-nominal mapping, since it has no fixed alternative; the spec says so directly.
Drop the exact-nominal rule from map_256 so sRGB never lands on the theme-controlled indices 0-15. Standard red now emits 38;5;196, and the 256 round-trip sweep asserts that nominal colors stay at 16 or above while every cube and ramp color maps to its own index.
Merged
natemoo-re
added a commit
that referenced
this pull request
Dec 4, 2026
Main landed void update() (#166), element replay (#171), the retained frame pair (#169), cell coverage (#168), color encoding tiers (#148, #157, #158), synchronized output (#139), and pointer shape (#137). - update() can no longer return cleanup bytes, so resize and kitty-graphics denial enqueue wire image ids in a new fixed-capacity pending-deletion queue (§5.7); the next completed render emits the data-freeing deletions first (§9.2.6 step 0). Overflow collapses to one delete-all with transmission resets. - removeImage() returns void and uses the same queue, resolving Open Decision 4: render() is the Term's only output path. - Replay equivalence replaces snapshot equivalence; a replay carries the directive, never a resolution. - Placements tables follow the frame pair's roles; INV-I9 maps onto discarding the current frame. - Layout-box cell quantities are measured on the covered-cell rect (renderer-spec §7.11). - img bg takes the full color value space; ascii art colors encode at the frame's color tier; a color-tier change re-places without re-transmitting. - Graphics bytes sit inside the BSU/ESU pair; a graphics-only frame is not a no-op. §16.9 is dropped. - Probe query renumbered to 10; §4.5 moved to §4.4.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #60.
38;2;R;G;B, more than 16 colors →38;5;N, 16 or fewer →3x/9xrgba(255,0,0)→\x1b[38;5;196m. 16-color output has no fixed colors, so it picks the nearest palette entry (\x1b[31m). Want the theme's red? Use-ansi-red. This departs from 💡 Color-encoding modes (16-color / 256-color) derived from terminfo #60's38;5;1m, which was written before the-ansi-*keywords existedcolorModeoverride. Capability evidence is the only input, so it can't contradict probe results. To get truecolor, passdetectTerminal()or fold probe replies throughterm.update()-ansi-*palette colors are already 4-bit and come out the same in every tier. ACanvas/CanvasTextresolved from the probed theme is plain RGB and gets encoded for the current tierspecs/color-encoding-spec.md, which only covers what users see: how the tier is picked, the escape codes, how colors map down, and the redraw on tier change. renderer-spec §8.5 no longer says theme colors render "as truecolor"test/color-encoding-modes.test.tscovers every tier, the boundaries, a full 256 round-trip, defaults, palette pass-through, and theme-color tiering. Suites that pin truecolor bytes now pass a shared truecolor fixture