Fix NO_COLOR on TUI detail screens and add ROBOREV_COLOR_MODE env var#566
Open
strofimovsky wants to merge 2 commits intoroborev-dev:mainfrom
Open
Fix NO_COLOR on TUI detail screens and add ROBOREV_COLOR_MODE env var#566strofimovsky wants to merge 2 commits intoroborev-dev:mainfrom
strofimovsky wants to merge 2 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 (
|
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.
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