From 8450651a03d353cbe9810bfe5a9cd344f29ffddc Mon Sep 17 00:00:00 2001 From: Nicolas Peugnet Date: Tue, 15 Nov 2022 19:50:13 +0100 Subject: [PATCH] Better colors with black on white themes Added ColorDefault to more places by default and override some other specific places with white for better contrast. This should not affect White on black themes. --- ui/room-list.go | 2 +- ui/room-view.go | 2 +- ui/ui.go | 2 ++ ui/view-login.go | 18 +++++++++++++----- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/ui/room-list.go b/ui/room-list.go index 1de37ae..6425225 100644 --- a/ui/room-list.go +++ b/ui/room-list.go @@ -98,7 +98,7 @@ func NewRoomList(parent *MainView) *RoomList { scrollOffset: 0, mainTextColor: tcell.ColorDefault, - selectedTextColor: tcell.ColorDefault, + selectedTextColor: tcell.ColorWhite, selectedBackgroundColor: tcell.ColorDarkGreen, } for _, tag := range list.tags { diff --git a/ui/room-view.go b/ui/room-view.go index f910a6a..73fe967 100644 --- a/ui/room-view.go +++ b/ui/room-view.go @@ -132,7 +132,7 @@ func NewRoomView(parent *MainView, room *rooms.Room) *RoomView { } view.topic. - SetTextColor(tcell.ColorDefault). + SetTextColor(tcell.ColorWhite). SetBackgroundColor(tcell.ColorDarkGreen) view.status.SetBackgroundColor(tcell.ColorDimGray) diff --git a/ui/ui.go b/ui/ui.go index 370aa75..d823e64 100644 --- a/ui/ui.go +++ b/ui/ui.go @@ -48,6 +48,8 @@ type GomuksUI struct { func init() { mauview.Styles.PrimitiveBackgroundColor = tcell.ColorDefault + mauview.Styles.PrimaryTextColor = tcell.ColorDefault + mauview.Styles.BorderColor = tcell.ColorDefault mauview.Styles.ContrastBackgroundColor = tcell.ColorDarkGreen if tcellDB := os.Getenv("TCELLDB"); len(tcellDB) == 0 { if info, err := os.Stat("/usr/share/tcell/database"); err == nil && info.IsDir() { diff --git a/ui/view-login.go b/ui/view-login.go index db5060e..015a1f3 100644 --- a/ui/view-login.go +++ b/ui/view-login.go @@ -77,12 +77,20 @@ func (ui *GomuksUI) NewLoginView() mauview.Component { } hs := ui.gmx.Config().HS - view.homeserver.SetPlaceholder("https://example.com").SetText(hs) - view.username.SetPlaceholder("@user:example.com").SetText(string(ui.gmx.Config().UserID)) - view.password.SetPlaceholder("correct horse battery staple").SetMaskCharacter('*') + view.homeserver.SetPlaceholder("https://example.com").SetText(hs).SetTextColor(tcell.ColorWhite) + view.username.SetPlaceholder("@user:example.com").SetText(string(ui.gmx.Config().UserID)).SetTextColor(tcell.ColorWhite) + view.password.SetPlaceholder("correct horse battery staple").SetMaskCharacter('*').SetTextColor(tcell.ColorWhite) - view.quitButton.SetOnClick(func() { ui.gmx.Stop(true) }).SetBackgroundColor(tcell.ColorDarkCyan) - view.loginButton.SetOnClick(view.Login).SetBackgroundColor(tcell.ColorDarkCyan) + view.quitButton. + SetOnClick(func() { ui.gmx.Stop(true) }). + SetBackgroundColor(tcell.ColorDarkCyan). + SetForegroundColor(tcell.ColorWhite). + SetFocusedForegroundColor(tcell.ColorWhite) + view.loginButton. + SetOnClick(view.Login). + SetBackgroundColor(tcell.ColorDarkCyan). + SetForegroundColor(tcell.ColorWhite). + SetFocusedForegroundColor(tcell.ColorWhite) view. SetColumns([]int{1, 10, 1, 30, 1}).