Closed tmm1 closed 1 year ago
To clarify further.. the logs are still styled with brightness, but not colors. When I redirect stderr to a file, then it comes through correctly without any styling at all.
This seems to be a bug in the current used version of Termenv. For the time being, you could work around this bug using
package main
import (
...
"github.com/muesli/termenv"
"github.com/charmbracelet/lipgloss"
)
func main() {
lipgloss.SetColorProfile(termenv.TrueColor)
// or
lipgloss.SetColorProfile(termenv.ANSI256)
}
Thanks, that works for now.
I tried to figure out where the bug is in termenv but didn't have much luck. LMK if you discover any more details.
Log uses Lipgloss v0.6 which uses Termenv v0.11. Termenv assumes using os.Stdout
and falls back to no-colors if it's not a TTY. https://github.com/muesli/termenv/blob/v0.11.0/termenv.go#L45
Aha okay that explains it. I was looking at the code for master and couldn't see that.
Note: you can typically enforce color output by setting CLICOLOR_FORCE
to 1
.
Thanks, confirmed fixed!
I have a simple go program that logs to stderr, and produces some output that is redirected to a file.
It seems color detection is based on stdout status instead of stderr status?