mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-02-03 13:21:56 +02:00
support config unified color for commit authors
This commit is contained in:
parent
4f627e5d27
commit
3771f9c98b
@ -50,8 +50,6 @@ gui:
|
||||
showRandomTip: true
|
||||
showCommandLog: true
|
||||
commandLogSize: 8
|
||||
authorColors: # in case you're not happy with the randomly assigned colour
|
||||
'John Smith': '#ff0000'
|
||||
git:
|
||||
paging:
|
||||
colorArg: always
|
||||
@ -376,6 +374,28 @@ Alternatively you may have bold fonts disabled in your terminal, in which case e
|
||||
|
||||
If you're still having trouble please raise an issue.
|
||||
|
||||
## Custom Author Color
|
||||
|
||||
Lazygit will assgin a random color for every commit author in the commits pane by default.
|
||||
|
||||
You can customize the color in case you're not happy with the randomly assigned one:
|
||||
|
||||
```yaml
|
||||
gui:
|
||||
authorColors:
|
||||
'John Smith': '#ff0000 # use red for John Smith
|
||||
```
|
||||
|
||||
You can use wildcard to set a unified color in case your are lazy to customize the color for every author or you are just want a single color for all/other authors:
|
||||
```yaml
|
||||
gui:
|
||||
authorColors:
|
||||
# use red for John Smith
|
||||
'John Smith': '#ff0000
|
||||
# use blue for other authors
|
||||
'*': '#0000ff'
|
||||
```
|
||||
|
||||
## Example Coloring
|
||||
|
||||
![border example](../../assets/colored-border-example.png)
|
||||
|
@ -13,9 +13,13 @@ import (
|
||||
|
||||
// if these being global variables causes trouble we can wrap them in a struct
|
||||
// attached to the gui state.
|
||||
var authorInitialCache = make(map[string]string)
|
||||
var authorNameCache = make(map[string]string)
|
||||
var authorStyleCache = make(map[string]style.TextStyle)
|
||||
var (
|
||||
authorInitialCache = make(map[string]string)
|
||||
authorNameCache = make(map[string]string)
|
||||
authorStyleCache = make(map[string]style.TextStyle)
|
||||
)
|
||||
|
||||
const authorNameWildcard = "*"
|
||||
|
||||
func ShortAuthor(authorName string) string {
|
||||
if value, ok := authorInitialCache[authorName]; ok {
|
||||
@ -51,6 +55,11 @@ func AuthorStyle(authorName string) style.TextStyle {
|
||||
return value
|
||||
}
|
||||
|
||||
// use the unified style whatever the autor name is
|
||||
if value, ok := authorStyleCache[authorNameWildcard]; ok {
|
||||
return value
|
||||
}
|
||||
|
||||
value := trueColorStyle(authorName)
|
||||
|
||||
authorStyleCache[authorName] = value
|
||||
|
Loading…
x
Reference in New Issue
Block a user