1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-04-25 12:24:47 +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 - blue
cherryPickedCommitFgColor: cherryPickedCommitFgColor:
- cyan - cyan
unstagedChangesColor:
- red
commitLength: commitLength:
show: true show: true
mouseEvents: true mouseEvents: true

View File

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

View File

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

View File

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