mirror of
https://github.com/charmbracelet/gum
synced 2024-06-27 09:40:06 +02:00
Switch to termenv.EnvColorProfile() (#387)
* Switch to termenv.EnvColorProfile() This will allow users to set `NO_COLOR` and `CLICOLOR_FORCE` when they need to override the detected values. * Update main.go
This commit is contained in:
parent
d1ad453ce6
commit
3011457a41
|
@ -54,7 +54,7 @@ func markdown(input string, theme string) (string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func template(input string) (string, error) {
|
func template(input string) (string, error) {
|
||||||
f := termenv.TemplateFuncs(termenv.ColorProfile())
|
f := termenv.TemplateFuncs(termenv.EnvColorProfile())
|
||||||
t, err := tpl.New("tpl").Funcs(f).Parse(input)
|
t, err := tpl.New("tpl").Funcs(f).Parse(input)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("unable to parse template: %w", err)
|
return "", fmt.Errorf("unable to parse template: %w", err)
|
||||||
|
|
2
main.go
2
main.go
|
@ -28,7 +28,7 @@ var (
|
||||||
var bubbleGumPink = lipgloss.NewStyle().Foreground(lipgloss.Color("212"))
|
var bubbleGumPink = lipgloss.NewStyle().Foreground(lipgloss.Color("212"))
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
lipgloss.SetColorProfile(termenv.NewOutput(os.Stderr).Profile)
|
lipgloss.SetColorProfile(termenv.NewOutput(os.Stderr).EnvColorProfile())
|
||||||
|
|
||||||
if Version == "" {
|
if Version == "" {
|
||||||
if info, ok := debug.ReadBuildInfo(); ok && info.Main.Sum != "" {
|
if info, ok := debug.ReadBuildInfo(); ok && info.Main.Sum != "" {
|
||||||
|
|
Loading…
Reference in a new issue