fix: honor color profile when rendering table cells#369
Open
semihbkgr wants to merge 1 commit into
Open
Conversation
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>
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
termenv.String(...), which hardcodes the Style's profile toANSI. WhenNO_COLORis set (or stdout is non-TTY),envisAsciiand theme colors collapse toNoColor{}— but because the Style still claimsANSI,Foreground(NoColor{}).Background(NoColor{})appends empty SGR slots and the renderer emits\x1b[;;m…\x1b[0maround the bar.env.String(...)carries the detected profile into the Style, soStyled()short-circuits and emits plain text underAscii. Behavior is unchanged for any non-Asciiprofile (the Style's profile is only consulted for theAsciishort-circuit; actual color codes come from eachColor.Sequence(...)).Fixes #364
🤖 Generated with Claude Code