Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graph highlight color depends on userconfig property #4032

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/Config.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ gui:
defaultFgColor:
- default

# Color for commit tree graph
commitTreeGraphHighlightColor:
- lightwhite

# Config relating to the commit length indicator
commitLength:
# If true, show an indicator of commit message length
Expand Down
3 changes: 3 additions & 0 deletions pkg/config/user_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ type ThemeConfig struct {
UnstagedChangesColor []string `yaml:"unstagedChangesColor" jsonschema:"minItems=1,uniqueItems=true"`
// Default text color
DefaultFgColor []string `yaml:"defaultFgColor" jsonschema:"minItems=1,uniqueItems=true"`
// Color for commit tree graph
CommitTreeGraphHighlightColor []string `yaml:"commitTreeGraphHighlightColor" jsonschema:"minItems=1,uniqueItems=true"`
}

type CommitLengthConfig struct {
Expand Down Expand Up @@ -704,6 +706,7 @@ func GetDefaultConfig() *UserConfig {
MarkedBaseCommitFgColor: []string{"blue"},
UnstagedChangesColor: []string{"red"},
DefaultFgColor: []string{"default"},
CommitTreeGraphHighlightColor: []string{"lightwhite"},
},
CommitLength: CommitLengthConfig{Show: true},
SkipNoStagedFilesWarning: false,
Expand Down
3 changes: 2 additions & 1 deletion pkg/gui/presentation/graph/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/jesseduffield/generics/set"
"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"
"github.com/samber/lo"
"golang.org/x/exp/slices"
Expand All @@ -30,7 +31,7 @@ type Pipe struct {
style style.TextStyle
}

var highlightStyle = style.FgLightWhite.SetBold()
var highlightStyle = theme.CommitTreeGraphHighlightColor.SetBold()

func ContainsCommitHash(pipes []*Pipe, hash string) bool {
for _, pipe := range pipes {
Expand Down
1 change: 1 addition & 0 deletions pkg/gui/style/basic_styles.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ var (
"magenta": {FgMagenta, BgMagenta},
"cyan": {FgCyan, BgCyan},
"white": {FgWhite, BgWhite},
"lightwhite": {FgLightWhite, BgWhite},
}
)

Expand Down
4 changes: 4 additions & 0 deletions pkg/theme/theme.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ var (
DiffTerminalColor = style.FgMagenta

UnstagedChangesColor = style.New()

CommitTreeGraphHighlightColor = style.New()
)

// UpdateTheme updates all theme variables
Expand Down Expand Up @@ -73,4 +75,6 @@ func UpdateTheme(themeConfig config.ThemeConfig) {

DefaultTextColor = GetTextStyle(themeConfig.DefaultFgColor, false)
GocuiDefaultTextColor = GetGocuiStyle(themeConfig.DefaultFgColor)

CommitTreeGraphHighlightColor = GetTextStyle(themeConfig.CommitTreeGraphHighlightColor, false)
}
12 changes: 12 additions & 0 deletions schema/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,18 @@
"default": [
"default"
]
},
"commitTreeGraphHighlightColor": {
"items": {
"type": "string"
},
"type": "array",
"minItems": 1,
"uniqueItems": true,
"description": "Color for commit tree graph",
"default": [
"lightwhite"
]
}
},
"additionalProperties": false,
Expand Down
Loading