diff options
author | Cokile <kelvintgx@gmail.com> | 2021-12-07 18:10:29 +0800 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2021-12-25 11:54:27 +1100 |
commit | 3771f9c98b8083f65599dc8c1a4262bf46d8ff27 (patch) | |
tree | d54bbf190749992378109b845b2a8cd70b8cf1a4 /pkg | |
parent | 4f627e5d27ed0b1f5767bd5b629616b30a9fa011 (diff) |
support config unified color for commit authors
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/gui/presentation/authors/authors.go | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/pkg/gui/presentation/authors/authors.go b/pkg/gui/presentation/authors/authors.go index c48683a12..65016142f 100644 --- a/pkg/gui/presentation/authors/authors.go +++ b/pkg/gui/presentation/authors/authors.go @@ -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 |