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:
committed by
Jesse Duffield
parent
4df7646654
commit
9adf4a1908
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user