1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-11-24 08:52:21 +02:00

Add unstagedChangesColor config option

This commit is contained in:
Daniel Kiss 2022-01-29 00:15:55 +01:00 committed by Jesse Duffield
parent 91dab7fef9
commit f5a5b7f966
4 changed files with 13 additions and 4 deletions

View File

@ -40,6 +40,8 @@ gui:
- blue
cherryPickedCommitFgColor:
- cyan
unstagedChangesColor:
- red
commitLength:
show: true
mouseEvents: true

View File

@ -54,6 +54,7 @@ type ThemeConfig struct {
SelectedRangeBgColor []string `yaml:"selectedRangeBgColor"`
CherryPickedCommitBgColor []string `yaml:"cherryPickedCommitBgColor"`
CherryPickedCommitFgColor []string `yaml:"cherryPickedCommitFgColor"`
UnstagedChangesColor []string `yaml:"unstagedChangesColor"`
}
type CommitLengthConfig struct {
@ -342,6 +343,7 @@ func GetDefaultConfig() *UserConfig {
SelectedRangeBgColor: []string{"blue"},
CherryPickedCommitBgColor: []string{"blue"},
CherryPickedCommitFgColor: []string{"cyan"},
UnstagedChangesColor: []string{"red"},
},
CommitLength: CommitLengthConfig{Show: true},
SkipNoStagedFilesWarning: false,

View File

@ -129,7 +129,7 @@ func getFileLine(hasUnstagedChanges bool, hasStagedChanges bool, name string, di
} else if file == nil && hasStagedChanges && hasUnstagedChanges {
restColor = partiallyModifiedColor
} else if hasUnstagedChanges {
restColor = style.FgRed
restColor = theme.UnstagedChangesColor
}
output := ""
@ -138,13 +138,13 @@ func getFileLine(hasUnstagedChanges bool, hasStagedChanges bool, name string, di
firstChar := file.ShortStatus[0:1]
firstCharCl := style.FgGreen
if firstChar == "?" {
firstCharCl = style.FgRed
firstCharCl = theme.UnstagedChangesColor
} else if firstChar == " " {
firstCharCl = restColor
}
secondChar := file.ShortStatus[1:2]
secondCharCl := style.FgRed
secondCharCl := theme.UnstagedChangesColor
if secondChar == " " {
secondCharCl = restColor
}
@ -193,7 +193,7 @@ func getColorForChangeStatus(changeStatus string) style.TextStyle {
case "M", "R":
return style.FgYellow
case "D":
return style.FgRed
return theme.UnstagedChangesColor
case "C":
return style.FgCyan
case "T":

View File

@ -39,6 +39,8 @@ var (
OptionsFgColor = style.New()
DiffTerminalColor = style.FgMagenta
UnstagedChangesColor = style.New()
)
// UpdateTheme updates all theme variables
@ -52,6 +54,9 @@ func UpdateTheme(themeConfig config.ThemeConfig) {
cherryPickedCommitFgTextStyle := GetTextStyle(themeConfig.CherryPickedCommitFgColor, false)
CherryPickedCommitTextStyle = cherryPickedCommitBgTextStyle.MergeStyle(cherryPickedCommitFgTextStyle)
unstagedChangesTextStyle := GetTextStyle(themeConfig.UnstagedChangesColor, false)
UnstagedChangesColor = unstagedChangesTextStyle
GocuiSelectedLineBgColor = GetGocuiStyle(themeConfig.SelectedLineBgColor)
OptionsColor = GetGocuiStyle(themeConfig.OptionsTextColor)
OptionsFgColor = GetTextStyle(themeConfig.OptionsTextColor, false)