diff --git a/docs/Config.md b/docs/Config.md index ed6f6dfde..7134d1b8b 100644 --- a/docs/Config.md +++ b/docs/Config.md @@ -40,6 +40,8 @@ gui: - blue cherryPickedCommitFgColor: - cyan + unstagedChangesColor: + - red commitLength: show: true mouseEvents: true diff --git a/pkg/config/user_config.go b/pkg/config/user_config.go index 9d7781358..3b4e0f139 100644 --- a/pkg/config/user_config.go +++ b/pkg/config/user_config.go @@ -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, diff --git a/pkg/gui/presentation/files.go b/pkg/gui/presentation/files.go index 116d4fc4b..d431e0bf8 100644 --- a/pkg/gui/presentation/files.go +++ b/pkg/gui/presentation/files.go @@ -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": diff --git a/pkg/theme/theme.go b/pkg/theme/theme.go index c3e12fdcc..39347702a 100644 --- a/pkg/theme/theme.go +++ b/pkg/theme/theme.go @@ -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)