Repository navigation
feat: color-encoding tiers derived from capability evidence - #148
Draft
natemoo-re wants to merge 2 commits into
Draft
natemoo-re wants to merge 2 commits into
natemoo-re wants to merge 2 commits into
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
|
Size Increased — +1.8 KB 135.3 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
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. Closes #60
CI's lint job flagged the unused InputEvent import and the two control-character regexes (the same no-control-regex suppression term.test.ts uses). Local verify runs fmt only, which is why lint slipped; deno lint is now clean on this branch.
natemoo-re
force-pushed
the
feat/color-encoding-modes
branch
from
December 1, 2026 04:43
f299323 to
9295b93
Compare
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.
What
The renderer now resolves a color tier from its capability snapshot instead of hardcoding 24-bit truecolor:
colorModeoverride — capability evidence is the single lever (TINV-3); an override would be a second source of truth that can contradict probe responses. Callers control the encoding the same way they control every other capability:detectTerminal()or folding probe responses throughterm.update().emit_attr(where the color is known): nominal-16 exact match → exact cube → grayscale ramp → nearest cube; ties resolve to the lowest index. Standard palette colors keep their classic indices —rgba(255,0,0)→\x1b[31m/\x1b[41munder"16",\x1b[38;5;1munder"256"— exactly the pins from 💡 Color-encoding modes (16-color / 256-color) derived from terminfo #60's repro.colorsvalue and truecolor flag are pushed once at creation and after capability folds, never copied per render. Resizes must not reset them to baseline.Spec
New focused feature spec
specs/color-encoding-spec.md(renderer-spec §7.8 explicitly defers color encoding to "a focused feature specification"). Conforming edits: §7.8 drops color encoding from its deferred list; §8.1 cross-references the new spec from theterminfoparameter. No public API signatures change.With no color evidence, the baseline
{colors: 256, trueColor: false}now resolves to "256" — the renderer emits 256-color SGR where it previously hardcoded truecolor. This is the terminfo-spec §7.1 evidence model applied to emission ("Truecolor is not assumed at baseline; it requires positive evidence") and matches theTermOptionsdoc from #133 ("the renderer uses the 256-color baseline"). The issue's "byte-identical to today" guarantee holds for truecolor-evidenced terminals (CI-2). The three files that pin\x1b[38;2;bytes (term/border/colortests) now inject a shared truecolor-evidence fixture so they continue to exercise the truecolor tier explicitly; the new default is pinned once intest/color-encoding-modes.test.ts.Tests
test/color-encoding-modes.test.ts: all three tiers, tier-resolution boundaries (8/16/17,colors ≥ 2²⁴, granted flag), bg codes, palette round-trip (exhaustive 256 sweep), defaults (CI-6), truecolor byte-identitydeno task verifyclean; changeset includedRefs: