Skip to content

fix: honor color profile when rendering table cells#369

Open
semihbkgr wants to merge 1 commit into
muesli:masterfrom
semihbkgr:fix/no-color-bar-escape-sequences
Open

fix: honor color profile when rendering table cells#369
semihbkgr wants to merge 1 commit into
muesli:masterfrom
semihbkgr:fix/no-color-bar-escape-sequences

Conversation

@semihbkgr
Copy link
Copy Markdown

Summary

  • The bar renderer uses the package-level termenv.String(...), which hardcodes the Style's profile to ANSI. When NO_COLOR is set (or stdout is non-TTY), env is Ascii and theme colors collapse to NoColor{} — but because the Style still claims ANSI, Foreground(NoColor{}).Background(NoColor{}) appends empty SGR slots and the renderer emits \x1b[;;m…\x1b[0m around the bar.
  • Switching to env.String(...) carries the detected profile into the Style, so Styled() short-circuits and emits plain text under Ascii. Behavior is unchanged for any non-Ascii profile (the Style's profile is only consulted for the Ascii short-circuit; actual color codes come from each Color.Sequence(...)).

Fixes #364

🤖 Generated with Claude Code

Use env.String(...) instead of the package-level termenv.String(...) so
the detected color profile is carried into the Style. The package-level
constructor hardcodes profile to ANSI, which causes empty SGR escape
sequences (\x1b[;;m ... \x1b[0m) to wrap the usage bar when NO_COLOR is
set and stdout is non-TTY.

Fixes muesli#364

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

^[[;;m as well as ^[[0m are printed when NO_COLOR is set AND with piped → cat output

1 participant