diff --git a/internal/ui/components/modal.go b/internal/ui/components/modal.go index b9ad816..3be8f02 100644 --- a/internal/ui/components/modal.go +++ b/internal/ui/components/modal.go @@ -2,6 +2,8 @@ package components import ( "bbrew/internal/ui/theme" + + "github.com/gdamore/tcell/v2" "github.com/rivo/tview" ) @@ -11,11 +13,19 @@ type Modal struct { } func NewModal(theme *theme.Theme) *Modal { + // Use green background with black text for activated button + // Black text ensures consistent visibility across all terminal themes + activatedStyle := tcell.StyleDefault. + Background(theme.SuccessColor). + Foreground(tcell.ColorBlack). + Bold(true) + modal := tview.NewModal(). SetBackgroundColor(theme.ModalBgColor). SetTextColor(theme.DefaultTextColor). SetButtonBackgroundColor(theme.ButtonBgColor). - SetButtonTextColor(theme.ButtonTextColor) + SetButtonTextColor(theme.ButtonTextColor). + SetButtonActivatedStyle(activatedStyle) return &Modal{ view: modal, @@ -31,7 +41,8 @@ func (m *Modal) Build(text string, confirmFunc func(), cancelFunc func()) *tview m.view.ClearButtons() m.view. SetText(text). - AddButtons([]string{"Confirm", "Cancel"}). + // Add padding to button labels with spaces for better visual appearance + AddButtons([]string{" Confirm ", " Cancel "}). SetDoneFunc(func(buttonIndex int, _ string) { switch buttonIndex { case 0: diff --git a/internal/ui/components/table.go b/internal/ui/components/table.go index d493c32..1e1d0e7 100644 --- a/internal/ui/components/table.go +++ b/internal/ui/components/table.go @@ -2,6 +2,8 @@ package components import ( "bbrew/internal/ui/theme" + + "github.com/gdamore/tcell/v2" "github.com/rivo/tview" ) @@ -18,6 +20,10 @@ func NewTable(theme *theme.Theme) *Table { table.view.SetBorders(false) table.view.SetSelectable(true, false) table.view.SetFixed(1, 0) + + // Use reverse video for selection to ensure visibility on any terminal theme + table.view.SetSelectedStyle(tcell.StyleDefault.Reverse(true)) + return table } diff --git a/internal/ui/theme/theme.go b/internal/ui/theme/theme.go index 6e7e8bf..4017cda 100644 --- a/internal/ui/theme/theme.go +++ b/internal/ui/theme/theme.go @@ -1,8 +1,12 @@ package theme -import "github.com/gdamore/tcell/v2" +import ( + "github.com/gdamore/tcell/v2" + "github.com/rivo/tview" +) type Theme struct { + // Application-specific colors DefaultTextColor tcell.Color DefaultBgColor tcell.Color WarningColor tcell.Color @@ -18,24 +22,69 @@ type Theme struct { LegendColor tcell.Color TableHeaderColor tcell.Color SearchLabelColor tcell.Color + + // tview global styles (mapped to tview.Styles) + PrimitiveBackgroundColor tcell.Color + ContrastBackgroundColor tcell.Color + MoreContrastBackgroundColor tcell.Color + BorderColor tcell.Color + GraphicsColor tcell.Color + PrimaryTextColor tcell.Color + SecondaryTextColor tcell.Color + TertiaryTextColor tcell.Color + InverseTextColor tcell.Color + ContrastSecondaryTextColor tcell.Color } func NewTheme() *Theme { - return &Theme{ - DefaultTextColor: tcell.ColorWhite, - DefaultBgColor: tcell.ColorBlack, - WarningColor: tcell.ColorYellow, - SuccessColor: tcell.ColorGreen, - ErrorColor: tcell.ColorRed, + theme := &Theme{ + // Application-specific colors + DefaultTextColor: tcell.ColorDefault, + DefaultBgColor: tcell.ColorDefault, - TitleColor: tcell.ColorMediumVioletRed, + // Use standard ANSI colors that work well on both light and dark themes + WarningColor: tcell.ColorYellow, + SuccessColor: tcell.ColorGreen, + ErrorColor: tcell.ColorRed, + + // Component colors + TitleColor: tcell.ColorPurple, LabelColor: tcell.ColorYellow, - ButtonBgColor: tcell.ColorGray, - ButtonTextColor: tcell.ColorWhite, + ButtonBgColor: tcell.ColorDefault, + ButtonTextColor: tcell.ColorDefault, - ModalBgColor: tcell.ColorDarkSlateGray, - LegendColor: tcell.ColorWhite, + ModalBgColor: tcell.ColorDefault, + LegendColor: tcell.ColorDefault, TableHeaderColor: tcell.ColorBlue, - SearchLabelColor: tcell.ColorMediumVioletRed, + SearchLabelColor: tcell.ColorPurple, + + // tview global styles - use terminal default colors for better compatibility + // By default, tview uses hardcoded colors (like tcell.ColorBlack) which don't + // adapt to the terminal's theme. We set them all to ColorDefault. + PrimitiveBackgroundColor: tcell.ColorDefault, + ContrastBackgroundColor: tcell.ColorDefault, + MoreContrastBackgroundColor: tcell.ColorDefault, + BorderColor: tcell.ColorDefault, + GraphicsColor: tcell.ColorDefault, + PrimaryTextColor: tcell.ColorDefault, + SecondaryTextColor: tcell.ColorDefault, + TertiaryTextColor: tcell.ColorDefault, + InverseTextColor: tcell.ColorDefault, + ContrastSecondaryTextColor: tcell.ColorDefault, } + + // Apply theme to tview global styles + tview.Styles.PrimitiveBackgroundColor = theme.PrimitiveBackgroundColor + tview.Styles.ContrastBackgroundColor = theme.ContrastBackgroundColor + tview.Styles.MoreContrastBackgroundColor = theme.MoreContrastBackgroundColor + tview.Styles.BorderColor = theme.BorderColor + tview.Styles.TitleColor = theme.TitleColor + tview.Styles.GraphicsColor = theme.GraphicsColor + tview.Styles.PrimaryTextColor = theme.PrimaryTextColor + tview.Styles.SecondaryTextColor = theme.SecondaryTextColor + tview.Styles.TertiaryTextColor = theme.TertiaryTextColor + tview.Styles.InverseTextColor = theme.InverseTextColor + tview.Styles.ContrastSecondaryTextColor = theme.ContrastSecondaryTextColor + + return theme }