refactor(colors): Add colors structure with all the needed colors (fix #7)

This commit is contained in:
Noah 2024-03-17 22:27:11 -05:00
parent ee4d23765d
commit 174dcb9706
3 changed files with 32 additions and 7 deletions

25
colors.go Normal file
View File

@ -0,0 +1,25 @@
package main
import "github.com/charmbracelet/lipgloss"
type Colors struct {
green lipgloss.Color
text lipgloss.Color
surface []lipgloss.Color
overlay []lipgloss.Color
}
var colors = Colors{
green: lipgloss.Color("#a6da95"),
text: lipgloss.Color("#cad3f5"),
surface: []lipgloss.Color{
lipgloss.Color("#363a4f"),
lipgloss.Color("#494d64"),
lipgloss.Color("#5b6078"),
},
overlay: []lipgloss.Color{
lipgloss.Color("#6e738d"),
lipgloss.Color("#8087a2"),
lipgloss.Color("#939ab7"),
},
}

View File

@ -32,7 +32,7 @@ func (i IndicatorInfo) String() string {
func initialIndicator() Indicator {
s := spinner.New()
s.Spinner = spinner.Dot
s.Style = lipgloss.NewStyle().Foreground(lipgloss.Color("#a6da95"))
s.Style = lipgloss.NewStyle().Foreground(colors.green)
return Indicator{spinner: s}
}
func (m Indicator) Init() tea.Cmd {

View File

@ -59,7 +59,7 @@ func getTimeLogs(since time.Time, on_process_repo func(repo gitea.Repository, to
return times
}
var textStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#5b6078"))
var textStyle = lipgloss.NewStyle().Foreground(colors.surface[2])
type timesviewer struct {
table table.Model
@ -90,7 +90,7 @@ func (m timesviewer) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
}
func (m timesviewer) View() string {
var totalTextStyle = lipgloss.NewStyle().
Foreground(lipgloss.Color("#6e738d")).
Foreground(colors.overlay[0]).
Bold(true)
return m.table.View() +
textStyle.Render("\nUse Up and Down arrows to navigate") +
@ -152,14 +152,14 @@ func times() {
)
s := table.DefaultStyles()
s.Header = s.Header.
Foreground(lipgloss.Color("#6e738d")).
Foreground(colors.overlay[0]).
BorderStyle(lipgloss.DoubleBorder()).
BorderForeground(lipgloss.Color("#a6da95")).
BorderForeground(colors.green).
BorderBottom(true).
Bold(false)
s.Selected = s.Selected.
Foreground(lipgloss.Color("#494d64")).
Background(lipgloss.Color("#a6da95")).
Foreground(colors.surface[1]).
Background(colors.green).
Bold(false)
tab.SetStyles(s)
tv.table = tab