diff options
Diffstat (limited to 'pkg/gui/presentation')
-rw-r--r-- | pkg/gui/presentation/authors/authors.go | 5 | ||||
-rw-r--r-- | pkg/gui/presentation/branches.go | 13 |
2 files changed, 6 insertions, 12 deletions
diff --git a/pkg/gui/presentation/authors/authors.go b/pkg/gui/presentation/authors/authors.go index 7924ba369..d4eb8e465 100644 --- a/pkg/gui/presentation/authors/authors.go +++ b/pkg/gui/presentation/authors/authors.go @@ -114,8 +114,5 @@ func getFirstRune(str string) rune { } func SetCustomAuthors(customAuthorColors map[string]string) { - for authorName, colorSequence := range customAuthorColors { - style := style.New().SetFg(style.NewRGBColor(color.HEX(colorSequence, false))) - authorStyleCache[authorName] = style - } + authorStyleCache = utils.SetCustomColors(customAuthorColors) } diff --git a/pkg/gui/presentation/branches.go b/pkg/gui/presentation/branches.go index 50a4ef094..e31c823ce 100644 --- a/pkg/gui/presentation/branches.go +++ b/pkg/gui/presentation/branches.go @@ -4,13 +4,13 @@ import ( "fmt" "strings" - "github.com/gookit/color" "github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/gui/style" "github.com/jesseduffield/lazygit/pkg/theme" + "github.com/jesseduffield/lazygit/pkg/utils" ) -var branchPrefixColors = make(map[string]style.TextStyle) +var branchPrefixColorCache = make(map[string]style.TextStyle) func GetBranchListDisplayStrings(branches []*models.Branch, fullDescription bool, diffName string) [][]string { lines := make([][]string, len(branches)) @@ -61,7 +61,7 @@ func getBranchDisplayStrings(b *models.Branch, fullDescription bool, diffed bool func GetBranchTextStyle(name string) style.TextStyle { branchType := strings.Split(name, "/")[0] - if value, ok := branchPrefixColors[branchType]; ok { + if value, ok := branchPrefixColorCache[branchType]; ok { return value } @@ -92,9 +92,6 @@ func BranchStatus(branch *models.Branch) string { return fmt.Sprintf("ā%sā%s", branch.Pushables, branch.Pullables) } -func SetCustomBranchColors(customBranchColors map[string]string) { - for branchPrefix, colorSequence := range customBranchColors { - style := style.New().SetFg(style.NewRGBColor(color.HEX(colorSequence, false))) - branchPrefixColors[branchPrefix] = style - } +func SetCustomBranches(customBranchColors map[string]string) { + branchPrefixColorCache = utils.SetCustomColors(customBranchColors) } |