1package ui23import (4 "image/color"56 "charm.land/lipgloss/v2"7)89// theme holds every style the UI uses, resolved for a light or dark terminal.10type theme struct {11 isDark bool1213 accent, dim, faint, text color.Color14 added, modified, removed, renamed color.Color15 fresh, warm, selBg color.Color1617 title, muted, subtle, bold lipgloss.Style18 sel, selDim lipgloss.Style19 tabActive, tabInactive lipgloss.Style20 key, keyDesc lipgloss.Style21 addSt, modSt, remSt, renSt lipgloss.Style22 freshSt, warmSt lipgloss.Style23 diffAdd, diffDel, diffHunk lipgloss.Style24}2526func newTheme(isDark bool) theme {27 ld := lipgloss.LightDark(isDark)28 t := theme{29 isDark: isDark,30 accent: ld(lipgloss.Color("#007F5F"), lipgloss.Color("#5FD7AF")),31 dim: ld(lipgloss.Color("#8A8A8A"), lipgloss.Color("#6C6C6C")),32 faint: ld(lipgloss.Color("#BCBCBC"), lipgloss.Color("#3A3A3A")),33 text: ld(lipgloss.Color("#1C1C1C"), lipgloss.Color("#E4E4E4")),34 added: ld(lipgloss.Color("#2E7D32"), lipgloss.Color("#87D75F")),35 modified: ld(lipgloss.Color("#B26A00"), lipgloss.Color("#FFD75F")),36 removed: ld(lipgloss.Color("#C62828"), lipgloss.Color("#FF5F87")),37 renamed: ld(lipgloss.Color("#1565C0"), lipgloss.Color("#5FAFFF")),38 fresh: ld(lipgloss.Color("#00A86B"), lipgloss.Color("#5FFF87")),39 warm: ld(lipgloss.Color("#7FBF9F"), lipgloss.Color("#3F8F5F")),40 selBg: ld(lipgloss.Color("#E0E8E4"), lipgloss.Color("#26323A")),41 }42 t.title = lipgloss.NewStyle().Foreground(t.accent).Bold(true)43 t.muted = lipgloss.NewStyle().Foreground(t.dim)44 t.subtle = lipgloss.NewStyle().Foreground(t.faint)45 t.bold = lipgloss.NewStyle().Foreground(t.text).Bold(true)46 t.sel = lipgloss.NewStyle().Background(t.selBg).Foreground(t.text).Bold(true)47 t.selDim = lipgloss.NewStyle().Background(t.selBg)48 t.tabActive = lipgloss.NewStyle().Foreground(t.accent).Bold(true).Underline(true)49 t.tabInactive = lipgloss.NewStyle().Foreground(t.dim)50 t.key = lipgloss.NewStyle().Foreground(t.accent).Bold(true)51 t.keyDesc = lipgloss.NewStyle().Foreground(t.dim)52 t.addSt = lipgloss.NewStyle().Foreground(t.added)53 t.modSt = lipgloss.NewStyle().Foreground(t.modified)54 t.remSt = lipgloss.NewStyle().Foreground(t.removed)55 t.renSt = lipgloss.NewStyle().Foreground(t.renamed)56 t.freshSt = lipgloss.NewStyle().Foreground(t.fresh).Bold(true)57 t.warmSt = lipgloss.NewStyle().Foreground(t.warm)58 t.diffAdd = lipgloss.NewStyle().Foreground(t.added)59 t.diffDel = lipgloss.NewStyle().Foreground(t.removed)60 t.diffHunk = lipgloss.NewStyle().Foreground(t.renamed)61 return t62}6364func (t theme) glamourStyle() string {65 if t.isDark {66 return "dark"67 }68 return "light"69}