💡 Color-encoding modes (16-color / 256-color) derived from terminfo
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 68/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- c, typescript
- Ambito
- cli
Direzione di ricerca
Inizia da emit_attr in src/clayterm.c:90 e dalla gestione esistente di terminfo in input.ts:441-448. Esegui test/color-encoding-modes.test.ts per stabilire il comportamento previsto per 16 colori, 256 colori, truecolor e gli override. Il lavoro è completato quando le modalità derivate da terminfo e quelle esplicite emettono la codifica richiesta, mentre il valore predefinito rimane identico byte per byte.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Is your feature request related to a problem?
The renderer only generates 24-bit truecolor. emit_attr (src/clayterm.c:90) always emits \x1b[38;2;R;G;Bm / \x1b[48;2;R;G;Bm, with no way to ask for a narrower encoding. Applying the standard ANSI red emits \x1b[38;2;255;0;0m even when the destination is a 16-color terminal, a CI log, or a pipe that would render \x1b[31m better (or only understands the smaller palette).
Describe the solution you'd like
Derive the output color depth from the terminal's capabilities (terminfo), with an explicit colorMode override. We already accept a compiled terminfo binary on the input side (createInput({ terminfo }), input.ts:448); the renderer can read the same source's color capability (max_colors, plus the truecolor flag) to pick an encoding, and take an override for callers who want to force the color mode:
// derive from terminfo capabilities (default behavior stays truecolor—byte-identical to today)
const term = await createTerm({ width, height, terminfo });
// or force it explicitly
const term = await createTerm({ width, height, colorMode: "16" }); // standard red -> \x1b[31m (bg \x1b[41m)
const term = await createTerm({ width, height, colorMode: "256" }); // standard red -> \x1b[38;5;1m
Describe alternatives you've considered
Rewriting the byte stream in TS (parsing emitted SGR and downsampling 24-bit sequences) is fragile and wasteful—it re-parses what the renderer just produced. The reverse-mapping belongs in emit_attr, where the color is known.
Additional context
Failing test case on nm/repro/color-encoding-modes (test · diff).
The core change likely lives in emit_attr (src/clayterm.c:90). Existing terminfo precedent is input.ts:441-448.
- Lingua principale
- TypeScript
- Stelle
- 42
- Fork
- 2
- Merge medio
- 2g 5h
- PR unite (30g)
- 12
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di bombshell-dev/tty
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
bombshell-dev/tty#61 · 1 reazione ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
bombshell-dev/tty#129 ·
-
question
Difficoltà 5/5 Più di una settimana Idoneità per principianti 38/100
bombshell-dev/tty#112 ·
-
enhancement high priority
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
bombshell-dev/tty#83 · 2 commenti ·
-
enhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
bombshell-dev/tty#82 ·
Tutte le issue di bombshell-dev/tty
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
bug v2
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
modelcontextprotocol/inspector#2458 · 1 commento ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
railmapgen/rmp-gallery#4068 ·
-
Mend: dependency security vulnerability status: needs triage 🕵️♀️
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
carbon-design-system/ibm-products#9907 ·