Repository navigation
Convert direct terminal output to the detected color profile - #370
Merged
Merged
Conversation
Bubble Tea converts colors to the profile it detects, but output written straight to the terminal was always truecolor, so without COLORTERM the live compose view and -g looked different from the final table and the log lines. Direct output now converts to DS2's detected profile too, and the compose viewport uses that profile instead of guessing from TERM/COLORTERM. A running TUI and Kitty image placeholders are left as is.
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.
What
Output DS2 writes straight to the terminal now uses the same color profile as its Bubble Tea views, so both show the same colors.
Why
Bubble Tea converts colors to the profile it detects. Direct output was always truecolor. When
COLORTERMisn't set and the terminal doesn't answer DS2's query, the two disagreed:-gshowed 256-color stand-ins for an ANSI tint.Changes
console.ToProfileconverts SGR color codes to the detected profile.console.ForTerminalfills in tints first, then converts.console.Println, CLI tables, logger console messages andDisplay;--config-show, the prune display, and--man.--manskips the conversion for Kitty placeholders, which carry their image ID in their color.TERM/COLORTERM.Testing
go build,go vet, and tests for the changed packages. NewTestToProfilecovers truecolor, 256-color, no-color, plain text, hyperlinks, and the running-TUI case.TERM=xterm-256color,--config-showemits 174 truecolor codes withCOLORTERM=truecolorand 146 256-color codes without it.