gum
gum copied to clipboard
The color is missing when redirecting stderr to stdout since v0.10.0
Describe the bug The color is missing when redirecting stderr to stdout
To Reproduce
Steps to reproduce the behavior:
gum confirm "Are you sure to perform this action ?" 2>&1 | tee
or
gum confirm "Are you sure to perform this action ?" |& tee
Expected behavior Having the color even if we redirect stderr to stdout
Screenshots
Not working since v0.10
Working without redirect
Desktop
- ALL platform
- wsl (ubuntu) , linux, macos
Same behavior here with 0.10.0 on WSL2 v5.15.90.1 kernel , no issues with 0.9.0
Does this issue still occur? Testing post- #324 seems to show no problems.
@hopefulTex the latest release still 0.10.0 to me. I download the binary. I confirm it still occur.
It seems that since termenv
is detecting the pipe, it's getting rid of the ansi sequences to avoid spitting out trash to tee
.
There are ~two ways to fix this immediately,
Technically, you should be able to force a profile by setting the CLICOLOR_FORCE
environment variable, however it did not work on my system.
If you're okay with running your own fork you can change line 31 from
lipgloss.SetColorProfile(termenv.NewOutput(os.Stderr).Profile)
to
lipgloss.SetColorProfile(termenv.ANSI256)
, with ANSI256
replaced by whatever suits your setup. Palettes can be found here :)
If you put in a feature request for a 'force color' option, I won't be saddled by exams by mid-May if someone else doesn't get to it first :)
In my case I change of colors of elements:
export GUM_CONFIRM_UNSELECTED_BACKGROUND="0"
export GUM_CONFIRM_UNSELECTED_FOREGROUND="15"
export GUM_CONFIRM_SELECTED_BACKGROUND="15"
export GUM_CONFIRM_SELECTED_FOREGROUND="0"
Anyone finding this in the future, this seems to be resolved now; though CLICOLOR_FORCE=true
is still needed