From c36c6ae17dad69834ac5aab8d554fc0867b2d91e Mon Sep 17 00:00:00 2001 From: Anton Medvedev Date: Sun, 10 Mar 2024 21:59:19 +0100 Subject: [PATCH] Set correct term profile --- main.go | 4 +--- theme.go | 6 +++++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index 663cb97..2e5dc7e 100644 --- a/main.go +++ b/main.go @@ -22,7 +22,6 @@ import ( "github.com/charmbracelet/lipgloss" "github.com/goccy/go-yaml" "github.com/mattn/go-isatty" - "github.com/muesli/termenv" "github.com/sahilm/fuzzy" jsonpath "github.com/antonmedv/fx/path" @@ -162,8 +161,7 @@ func main() { search: newSearch(), } - output := termenv.NewOutput(os.Stderr) - lipgloss.SetColorProfile(output.ColorProfile()) + lipgloss.SetColorProfile(termOutput.ColorProfile()) p := tea.NewProgram(m, tea.WithAltScreen(), diff --git a/theme.go b/theme.go index c8e3d22..c298eb6 100644 --- a/theme.go +++ b/theme.go @@ -50,6 +50,10 @@ func valueStyle(b []byte, selected, chunk bool) color { } } +var ( + termOutput = termenv.NewOutput(os.Stderr) +) + func init() { themeNames = make([]string, 0, len(themes)) for name := range themes { @@ -68,7 +72,7 @@ func init() { os.Exit(1) } - if termenv.ColorProfile() == termenv.Ascii { + if termOutput.ColorProfile() == termenv.Ascii { currentTheme = themes["0"] }