mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-02-03 13:21:56 +02:00
feat: accept named colors for gui.authorColors
This commit is contained in:
parent
f143d04d87
commit
494368a241
@ -384,7 +384,8 @@ You can customize the color in case you're not happy with the randomly assigned
|
|||||||
```yaml
|
```yaml
|
||||||
gui:
|
gui:
|
||||||
authorColors:
|
authorColors:
|
||||||
'John Smith': '#ff0000' # use red for John Smith
|
'John Smith': 'red' # use red for John Smith
|
||||||
|
'Alan Smithee': '#00ff00' # use green for Alan Smithee
|
||||||
```
|
```
|
||||||
|
|
||||||
You can use wildcard to set a unified color in case your are lazy to customize the color for every author or you just want a single color for all/other authors:
|
You can use wildcard to set a unified color in case your are lazy to customize the color for every author or you just want a single color for all/other authors:
|
||||||
@ -393,7 +394,7 @@ You can use wildcard to set a unified color in case your are lazy to customize t
|
|||||||
gui:
|
gui:
|
||||||
authorColors:
|
authorColors:
|
||||||
# use red for John Smith
|
# use red for John Smith
|
||||||
'John Smith': '#ff0000'
|
'John Smith': 'red'
|
||||||
# use blue for other authors
|
# use blue for other authors
|
||||||
'*': '#0000ff'
|
'*': '#0000ff'
|
||||||
```
|
```
|
||||||
|
@ -6,6 +6,7 @@ import (
|
|||||||
|
|
||||||
"github.com/gookit/color"
|
"github.com/gookit/color"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/style"
|
"github.com/jesseduffield/lazygit/pkg/gui/style"
|
||||||
|
"github.com/samber/lo"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -55,10 +56,10 @@ func IsValidHexValue(v string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func SetCustomColors(customColors map[string]string) map[string]style.TextStyle {
|
func SetCustomColors(customColors map[string]string) map[string]style.TextStyle {
|
||||||
colors := make(map[string]style.TextStyle)
|
return lo.MapValues(customColors, func(c string, key string) style.TextStyle {
|
||||||
for key, colorSequence := range customColors {
|
if s, ok := style.ColorMap[c]; ok {
|
||||||
style := style.New().SetFg(style.NewRGBColor(color.HEX(colorSequence, false)))
|
return s.Foreground
|
||||||
colors[key] = style
|
}
|
||||||
}
|
return style.New().SetFg(style.NewRGBColor(color.HEX(c, false)))
|
||||||
return colors
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user