mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-28 02:07:09 -04:00
Extract converting a configured color to a text style
The next commit needs it for a single color. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
573cd8a005
commit
ae1b43dc96
+10
-4
@@ -60,10 +60,16 @@ func IsValidHexValue(v string) bool {
|
||||
|
||||
func SetCustomColors(customColors map[string]string) map[string]*style.TextStyle {
|
||||
return lo.MapValues(customColors, func(c string, key string) *style.TextStyle {
|
||||
if s, ok := style.ColorMap[c]; ok {
|
||||
return &s.Foreground
|
||||
}
|
||||
value := style.New().SetFg(style.NewRGBColor(color.HEX(c, false)))
|
||||
value := CustomColorStyle(c)
|
||||
return &value
|
||||
})
|
||||
}
|
||||
|
||||
// CustomColorStyle returns the text style for a color that the user
|
||||
// configured, either by the name of a terminal color or as a hex value.
|
||||
func CustomColorStyle(c string) style.TextStyle {
|
||||
if s, ok := style.ColorMap[c]; ok {
|
||||
return s.Foreground
|
||||
}
|
||||
return style.New().SetFg(style.NewRGBColor(color.HEX(c, false)))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user