From 168c10aed0aab1194779481561fd73b33580bfa2 Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Thu, 21 Nov 2024 17:10:58 +0200 Subject: feat: add global background color --- internal/client/client.go | 7 +++++++ internal/client/ui/ui.go | 3 +++ 2 files changed, 10 insertions(+) (limited to 'internal') diff --git a/internal/client/client.go b/internal/client/client.go index 073da82..938a265 100644 --- a/internal/client/client.go +++ b/internal/client/client.go @@ -5,6 +5,7 @@ import ( "reflect" tea "github.com/charmbracelet/bubbletea" + "github.com/muesli/termenv" "github.com/kyren223/eko/internal/client/config" "github.com/kyren223/eko/internal/client/ui" @@ -29,6 +30,12 @@ func Run() { log.Fatalf("Config file at '%v' was unable to load successfully\n%v\n", config.ConfigFile, err) } + // HACK: Sets the terminal color and keeps it that way + // I am not aware of a way to query the current background color (to revert this) + // Ideally bubbletea will handle the setting/reventing, for now it's fine + // It only changes the current pane so new terminal panes/windows are not affected. + termenv.DefaultOutput().SetBackgroundColor(termenv.RGBColor(ui.BackgroundColor)) + program := tea.NewProgram(initialModel(), tea.WithAltScreen()) assert.AddFlush(BubbleTeaCloser{program}) diff --git a/internal/client/ui/ui.go b/internal/client/ui/ui.go index a208576..a1db45f 100644 --- a/internal/client/ui/ui.go +++ b/internal/client/ui/ui.go @@ -17,6 +17,9 @@ import ( var Width int var Height int +var BackgroundColor = "#1E1E2E" +var Background = lipgloss.Color(BackgroundColor) +var Style = lipgloss.NewStyle().Background(Background) type ModelTransition struct { Model tea.Model -- cgit v1.3.1