summaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2022-05-06 08:39:26 +1000
committerGitHub <noreply@github.com>2022-05-06 08:39:26 +1000
commit593eb19ca4506890021f80240b7701fdde18bfe2 (patch)
treed0adfa29f2e68dd8b6743591958756c48dafe79a /pkg
parent8c6260ed8d14c96053877568b806ba4aab307b3f (diff)
parent494368a241634e3473f46a10256df19d85dbb5f7 (diff)
Merge pull request #1910 from Ryooooooga/feature/named-author-colors
Diffstat (limited to 'pkg')
-rw-r--r--pkg/utils/color.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/pkg/utils/color.go b/pkg/utils/color.go
index 2eced49e2..a4ad578e0 100644
--- a/pkg/utils/color.go
+++ b/pkg/utils/color.go
@@ -6,6 +6,7 @@ import (
"github.com/gookit/color"
"github.com/jesseduffield/lazygit/pkg/gui/style"
+ "github.com/samber/lo"
)
var (
@@ -55,10 +56,10 @@ func IsValidHexValue(v string) bool {
}
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
+ return lo.MapValues(customColors, func(c string, key string) style.TextStyle {
+ if s, ok := style.ColorMap[c]; ok {
+ return s.Foreground
+ }
+ return style.New().SetFg(style.NewRGBColor(color.HEX(c, false)))
+ })
}