Fix NO_COLOR on TUI detail screens and add ROBOREV_COLOR_MODE env var#566
Fix NO_COLOR on TUI detail screens and add ROBOREV_COLOR_MODE env var#566wesm merged 5 commits intoroborev-dev:mainfrom
Conversation
roborev: Combined Review (
|
glamour's NewTermRenderer defaults to TrueColor profile, ignoring the NO_COLOR convention. This caused review/prompt detail screens to emit ANSI color sequences even with NO_COLOR=1, while the main queue screen (using lipgloss only) correctly suppressed colors. Pass glamour.WithColorProfile() when creating term renderers in both the TUI markdown cache and the streamfmt package. When NO_COLOR is set or ROBOREV_COLOR_MODE=none, the Ascii profile is used, which strips all color output from glamour. Also fix stripTrailingPadding/StripTrailingPadding to skip the unconditional \x1b[0m reset suffix in no-color mode. Add ROBOREV_COLOR_MODE env var (auto|dark|light|none) for explicit control over the TUI color theme without relying on terminal detection. GlamourStyle() and resolveColorMode() both respect this env var.
glamour's NewTermRenderer defaults to TrueColor profile, ignoring the NO_COLOR convention. Pass glamour.WithColorProfile() to all term renderers so NO_COLOR=1 strips colors from review/prompt detail screens. Add ROBOREV_COLOR_MODE env var (auto|dark|light|none) for explicit control over the TUI color theme. Apply the setting to both the glamour markdown layer and the lipgloss AdaptiveColor layer via SetHasDarkBackground/SetColorProfile on the default renderer. NO_COLOR takes precedence over ROBOREV_COLOR_MODE at all layers. Consolidate color resolution: remove duplicate resolveColorMode() from TUI helpers, delegate to streamfmt.GlamourStyle() and streamfmt.ResolveColorProfile(). GlamourStyle() now checks NO_COLOR to avoid unnecessary terminal background queries.
46c262d to
6251457
Compare
roborev: Combined Review (
|
In no-color mode, Glamour still emits non-color SGR sequences (bold, underline) via termenv.Ascii. Previously, stripTrailingPadding only removed trailing SGR sequences and omitted the reset, leaving mid-line attributes open to bleed into subsequent lines. Now strip all SGR sequences from the entire line when noColor is enabled. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Cover mid-line bold/underline SGR stripping, trailing padding removal, mixed sequences, and plain text preservation for both the TUI and streamfmt helpers. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The TestRenderMarkdownLinesNoColor tests claimed bold/reset sequences were preserved in Ascii mode, but stripTrailingPadding now strips all SGR. Update comments to reflect the current behavior and widen the regex to assert no SGR sequences of any kind remain. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Thanks for this, just pushed some roborev fixes. Will get this merged so I can release in the next hour or so |
roborev: Combined Review (
|
|
Not valid. Merging |
Summary
NO_COLOR=1not working on TUI review/prompt detail screens (glamour was ignoring it)ROBOREV_COLOR_MODEenv var (auto|dark|light|none) for explicit TUI color theme controlNO_COLORtakes precedence overROBOREV_COLOR_MODEat all layersProblem
glamour's
NewTermRendererdefaults toTrueColorprofile regardless ofNO_COLOR. The main queue screen (lipgloss only) correctly respectedNO_COLOR, but review/prompt detail screens (glamour-rendered markdown) always emitted ANSI color sequences.Additionally, there was no way to force a dark/light theme when terminal background auto-detection failed.
Changes
Core fix
glamour.WithColorProfile()to allglamour.NewTermRenderercalls in bothcmd/roborev/tui/helpers.goandinternal/streamfmt/render.gostripTrailingPadding/StripTrailingPaddingto skip the\x1b[0mreset suffix in no-color modeROBOREV_COLOR_MODE env var
auto(default): auto-detect terminal backgrounddark: force dark color palettelight: force light color palettenone: strip all colors (same asNO_COLOR=1)Lipgloss integration
lipgloss.SetHasDarkBackground()/lipgloss.SetColorProfile()in TUI startup soAdaptiveColorstyles on the queue screen also respect the env varNO_COLORfirst to ensure it always takes precedenceConsolidation
resolveColorMode()from TUI helpers; delegate tostreamfmt.GlamourStyle()+streamfmt.ResolveColorProfile()GlamourStyle()to checkNO_COLOR(previously skipped, causing unnecessary terminal background queries)Documentation
ROBOREV_COLOR_MODEandNO_COLORto README.md, AGENTS.md, and CLAUDE.mdTesting
go test ./...)TestResolveColorProfile,TestRenderMarkdownLinesNoColor,TestGlamourStyleRespectsColorModewith proper dark/light style differentiationNO_COLOR=1,ROBOREV_COLOR_MODE=none,=dark,=lightall work on both queue and detail screens