From d400a094b50a4d5b23bd8660df77a94c51685e98 Mon Sep 17 00:00:00 2001 From: Moritz Biering Date: Sun, 5 Nov 2023 15:01:52 +0100 Subject: [PATCH] Clean up the style configuration --- style.go | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/style.go b/style.go index d8deb96..1311883 100644 --- a/style.go +++ b/style.go @@ -33,8 +33,16 @@ type Style struct { } func DefaultNewsStyle() (s Style) { - s.ActiveStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("62")).BorderForeground(lipgloss.Color("62")) - s.TitleActiveStyle = lipgloss.NewStyle().Background(lipgloss.Color("62")).Foreground(lipgloss.Color("230")) + primaryColor := lipgloss.Color("62") + secondaryColor := lipgloss.Color("230") + normalTitleColor := lipgloss.Color("#DDDDDD") + normalDescColor := lipgloss.Color("#777777") + selectedPrimaryColor := lipgloss.Color("#AD58B4") + selectedSecondaryColor := lipgloss.Color("#EE6FF8") + breakingColor := lipgloss.Color("#FF0000") + + s.ActiveStyle = lipgloss.NewStyle().Foreground(primaryColor).BorderForeground(primaryColor) + s.TitleActiveStyle = lipgloss.NewStyle().Background(primaryColor).Foreground(secondaryColor) s.ListActiveStyle = s.ActiveStyle.Copy().Padding(1, 1, 1, 1).Margin(0, 1, 0, 1).BorderStyle(lipgloss.RoundedBorder()) s.ReaderTitleActiveStyle = func() lipgloss.Style { b := lipgloss.RoundedBorder() @@ -48,7 +56,7 @@ func DefaultNewsStyle() (s Style) { }() s.InactiveStyle = lipgloss.NewStyle() - s.TitleInactiveStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("230")) + s.TitleInactiveStyle = lipgloss.NewStyle().Foreground(secondaryColor) s.ListInactiveStyle = s.InactiveStyle.Copy().Padding(1, 1, 1, 1).Margin(0, 1, 0, 1).BorderStyle(lipgloss.RoundedBorder()) s.ReaderTitleInactiveStyle = func() lipgloss.Style { b := lipgloss.RoundedBorder() @@ -61,28 +69,18 @@ func DefaultNewsStyle() (s Style) { return s.ReaderTitleInactiveStyle.Copy().BorderStyle(b) }() - s.ItemNormalTitle = lipgloss.NewStyle(). - Foreground(lipgloss.AdaptiveColor{Light: "#1a1a1a", Dark: "#dddddd"}). - Padding(0, 0, 0, 2) + s.ItemNormalTitle = lipgloss.NewStyle().Foreground(normalTitleColor).Padding(0, 0, 0, 2) - s.ItemNormalDesc = s.ItemNormalTitle.Copy(). - Foreground(lipgloss.AdaptiveColor{Light: "#A49FA5", Dark: "#777777"}) + s.ItemNormalDesc = s.ItemNormalTitle.Copy().Foreground(normalDescColor) - s.ItemSelectedTitle = lipgloss.NewStyle(). - Border(lipgloss.NormalBorder(), false, false, false, true). - BorderForeground(lipgloss.AdaptiveColor{Light: "#F793FF", Dark: "#AD58B4"}). - Foreground(lipgloss.AdaptiveColor{Light: "#EE6FF8", Dark: "#EE6FF8"}). - Padding(0, 0, 0, 1) + s.ItemSelectedTitle = lipgloss.NewStyle().Border(lipgloss.NormalBorder(), false, false, false, true). + BorderForeground(selectedPrimaryColor).Foreground(selectedSecondaryColor).Padding(0, 0, 0, 1) - s.ItemSelectedDesc = s.ItemSelectedTitle.Copy(). - Foreground(lipgloss.AdaptiveColor{Light: "#F793FF", Dark: "#AD58B4"}) + s.ItemSelectedDesc = s.ItemSelectedTitle.Copy().Foreground(selectedPrimaryColor) - s.ItemBreakingTitle = lipgloss.NewStyle(). - Foreground(lipgloss.AdaptiveColor{Light: "#FF0000", Dark: "#FF0000"}). - Padding(0, 0, 0, 2) + s.ItemBreakingTitle = lipgloss.NewStyle().Foreground(breakingColor).Padding(0, 0, 0, 2) - s.ItemBreakingDesc = s.ItemBreakingTitle.Copy(). - Foreground(lipgloss.AdaptiveColor{Light: "#FF0000", Dark: "#FF0000"}) + s.ItemBreakingDesc = s.ItemBreakingTitle.Copy().Foreground(breakingColor) return s }