gum icon indicating copy to clipboard operation
gum copied to clipboard

The color is missing when redirecting stderr to stdout since v0.10.0

Open Romain7495 opened this issue 1 year ago • 6 comments

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 image

Working without redirect image

Desktop

  • ALL platform
  • wsl (ubuntu) , linux, macos

Romain7495 avatar Mar 29 '23 08:03 Romain7495

Same behavior here with 0.10.0 on WSL2 v5.15.90.1 kernel , no issues with 0.9.0

bagl3y avatar Mar 29 '23 08:03 bagl3y

Does this issue still occur? Testing post- #324 seems to show no problems.

hopefulTex avatar Apr 06 '23 18:04 hopefulTex

@hopefulTex the latest release still 0.10.0 to me. I download the binary. I confirm it still occur.

dannyloxavier avatar Apr 14 '23 12:04 dannyloxavier

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 :)

hopefulTex avatar Apr 19 '23 20:04 hopefulTex

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"

vtmx avatar Jun 03 '23 02:06 vtmx

Anyone finding this in the future, this seems to be resolved now; though CLICOLOR_FORCE=true is still needed

elken avatar Sep 07 '23 11:09 elken