1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

Add shared function for loading map of custom colors

This commit is contained in:
Matt Cles
2022-01-31 21:23:55 -08:00
committed by Jesse Duffield
parent 4df7646654
commit 9adf4a1908
4 changed files with 20 additions and 14 deletions

View File

@ -3,6 +3,9 @@ package utils
import (
"regexp"
"sync"
"github.com/gookit/color"
"github.com/jesseduffield/lazygit/pkg/gui/style"
)
var decoloriseCache = make(map[string]string)
@ -48,3 +51,12 @@ func IsValidHexValue(v string) bool {
return true
}
func SetCustomColors(customColors map[string]string) map[string]style.TextStyle {
colors := make(map[string]style.TextStyle)
for key, colorSequence := range customColors {
style := style.New().SetFg(style.NewRGBColor(color.HEX(colorSequence, false)))
colors[key] = style
}
return colors
}