11package tui
22
3- import "github.com/charmbracelet/lipgloss"
3+ import (
4+ "sort"
5+
6+ "github.com/charmbracelet/lipgloss"
7+ )
48
59// Palette defines a set of colors for a theme.
610type Palette struct {
@@ -105,6 +109,7 @@ type Theme struct {
105109 CommitMerge lipgloss.Style
106110 GraphEdge lipgloss.Style
107111 GraphNode lipgloss.Style
112+ GraphColors []lipgloss.Style
108113 StashName lipgloss.Style
109114 StashMessage lipgloss.Style
110115 ActiveBorder BorderStyle
@@ -130,11 +135,6 @@ type TreeStyle struct {
130135 Connector , ConnectorLast , Prefix , PrefixLast string
131136}
132137
133- const (
134- scrollThumb = "▐"
135- graphNode = "○"
136- )
137-
138138// Themes holds all the available themes, generated from palettes.
139139var Themes = map [string ]Theme {}
140140
@@ -166,23 +166,35 @@ func NewThemeFromPalette(p Palette) Theme {
166166 CommitMerge : lipgloss .NewStyle ().Foreground (lipgloss .Color (p .Magenta )),
167167 GraphEdge : lipgloss .NewStyle ().Foreground (lipgloss .Color (p .BrightBlack )),
168168 GraphNode : lipgloss .NewStyle ().Foreground (lipgloss .Color (p .Green )),
169- StashName : lipgloss .NewStyle ().Foreground (lipgloss .Color (p .Yellow )),
170- StashMessage : lipgloss .NewStyle ().Foreground (lipgloss .Color (p .Fg )),
169+ GraphColors : []lipgloss.Style {
170+ lipgloss .NewStyle ().Foreground (lipgloss .Color (p .Green )),
171+ lipgloss .NewStyle ().Foreground (lipgloss .Color (p .Yellow )),
172+ lipgloss .NewStyle ().Foreground (lipgloss .Color (p .Blue )),
173+ lipgloss .NewStyle ().Foreground (lipgloss .Color (p .Magenta )),
174+ lipgloss .NewStyle ().Foreground (lipgloss .Color (p .Cyan )),
175+ lipgloss .NewStyle ().Foreground (lipgloss .Color (p .BrightGreen )),
176+ lipgloss .NewStyle ().Foreground (lipgloss .Color (p .BrightYellow )),
177+ lipgloss .NewStyle ().Foreground (lipgloss .Color (p .BrightBlue )),
178+ lipgloss .NewStyle ().Foreground (lipgloss .Color (p .BrightMagenta )),
179+ lipgloss .NewStyle ().Foreground (lipgloss .Color (p .BrightCyan )),
180+ },
181+ StashName : lipgloss .NewStyle ().Foreground (lipgloss .Color (p .Yellow )),
182+ StashMessage : lipgloss .NewStyle ().Foreground (lipgloss .Color (p .Fg )),
171183 ActiveBorder : BorderStyle {
172- Top : "─" , Bottom : "─" , Left : "│" , Right : "│" ,
173- TopLeft : "╭" , TopRight : "╮" , BottomLeft : "╰" , BottomRight : "╯" ,
184+ Top : borderTop , Bottom : borderBottom , Left : borderLeft , Right : borderRight ,
185+ TopLeft : borderTopLeft , TopRight : borderTopRight , BottomLeft : borderBottomLeft , BottomRight : borderBottomRight ,
174186 Style : lipgloss .NewStyle ().Foreground (lipgloss .Color (p .BrightCyan )),
175187 },
176188 InactiveBorder : BorderStyle {
177- Top : "─" , Bottom : "─" , Left : "│" , Right : "│" ,
178- TopLeft : "╭" , TopRight : "╮" , BottomLeft : "╰" , BottomRight : "╯" ,
189+ Top : borderTop , Bottom : borderBottom , Left : borderLeft , Right : borderRight ,
190+ TopLeft : borderTopLeft , TopRight : borderTopRight , BottomLeft : borderBottomLeft , BottomRight : borderBottomRight ,
179191 Style : lipgloss .NewStyle ().Foreground (lipgloss .Color (p .BrightBlack )),
180192 },
181193 Tree : TreeStyle {
182- Connector : "" ,
183- ConnectorLast : "" ,
184- Prefix : " " ,
185- PrefixLast : " " ,
194+ Connector : treeConnector ,
195+ ConnectorLast : treeConnectorLast ,
196+ Prefix : treePrefix ,
197+ PrefixLast : treePrefixLast ,
186198 },
187199 }
188200}
@@ -193,5 +205,6 @@ func ThemeNames() []string {
193205 for name := range Palettes {
194206 names = append (names , name )
195207 }
208+ sort .Strings (names )
196209 return names
197210}
0 commit comments