From e93cadf1d6bc51d75ea627da27bc143802e251a0 Mon Sep 17 00:00:00 2001 From: KOLOSSA Tilman Date: Tue, 16 Aug 2022 13:53:33 +0200 Subject: [PATCH 1/2] changed "white" colors to "default" to work in both light and dark terminals --- pkg/gui/confirmation_panel.go | 6 ++++-- pkg/gui/gocui.go | 2 +- pkg/gui/menu_panel.go | 2 +- pkg/utils/utils.go | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pkg/gui/confirmation_panel.go b/pkg/gui/confirmation_panel.go index 9a8a5504..b20cbabf 100644 --- a/pkg/gui/confirmation_panel.go +++ b/pkg/gui/confirmation_panel.go @@ -81,7 +81,7 @@ func (gui *Gui) prepareConfirmationPanel(currentView *gocui.View, title, prompt gui.g.StartTicking() confirmationView.Title = title confirmationView.Wrap = true - confirmationView.FgColor = gocui.ColorWhite + confirmationView.FgColor = gocui.ColorDefault } gui.g.Update(func(g *gocui.Gui) error { return gui.switchFocus(gui.g, currentView, confirmationView, false) @@ -147,7 +147,9 @@ func (gui *Gui) setKeyBindings(g *gocui.Gui, handleConfirm, handleClose func(*go } // createSpecificErrorPanel allows you to create an error popup, specifying the -// view to be focused when the user closes the popup, and a boolean specifying +// +// view to be focused when the user closes the popup, and a boolean specifying +// // whether we will log the error. If the message may include a user password, // this function is to be used over the more generic createErrorPanel, with // willLog set to false diff --git a/pkg/gui/gocui.go b/pkg/gui/gocui.go index d06002cf..e4c0b155 100644 --- a/pkg/gui/gocui.go +++ b/pkg/gui/gocui.go @@ -32,7 +32,7 @@ func GetGocuiAttribute(key string) gocui.Attribute { if present { return value } - return gocui.ColorWhite + return gocui.ColorDefault } // GetGocuiStyle bitwise OR's a list of attributes obtained via the given keys diff --git a/pkg/gui/menu_panel.go b/pkg/gui/menu_panel.go index 39abc108..80cb7d94 100644 --- a/pkg/gui/menu_panel.go +++ b/pkg/gui/menu_panel.go @@ -75,7 +75,7 @@ func (gui *Gui) createMenu(title string, items interface{}, itemCount int, handl x0, y0, x1, y1 := gui.getConfirmationPanelDimensions(gui.g, false, list) menuView, _ := gui.g.SetView("menu", x0, y0, x1, y1, 0) menuView.Title = title - menuView.FgColor = gocui.ColorWhite + menuView.FgColor = gocui.ColorDefault menuView.Clear() fmt.Fprint(menuView, list) gui.State.Panels.Menu.SelectedLine = 0 diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index 2d9a73bc..fe1ae3de 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -293,7 +293,7 @@ func GetGocuiAttribute(key string) gocui.Attribute { if present { return value } - return gocui.ColorWhite + return gocui.ColorDefault } // GetColorAttribute gets the color attribute from the string From 49dd19b01ccb6da098f5ef14a2995398780791cd Mon Sep 17 00:00:00 2001 From: KOLOSSA Tilman Date: Tue, 16 Aug 2022 13:59:24 +0200 Subject: [PATCH 2/2] fixed faulty auto-formatting --- pkg/gui/confirmation_panel.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pkg/gui/confirmation_panel.go b/pkg/gui/confirmation_panel.go index b20cbabf..a3779289 100644 --- a/pkg/gui/confirmation_panel.go +++ b/pkg/gui/confirmation_panel.go @@ -147,9 +147,7 @@ func (gui *Gui) setKeyBindings(g *gocui.Gui, handleConfirm, handleClose func(*go } // createSpecificErrorPanel allows you to create an error popup, specifying the -// -// view to be focused when the user closes the popup, and a boolean specifying -// +// view to be focused when the user closes the popup, and a boolean specifying // whether we will log the error. If the message may include a user password, // this function is to be used over the more generic createErrorPanel, with // willLog set to false