mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-23 12:18:51 +02:00
Make cherry pick commit color customisable
Two new settings in the config, which allow the cherry picked foreground and background to be custom colors. Issue #856
This commit is contained in:
parent
663c036ca5
commit
c5f7ad5adb
@ -36,6 +36,10 @@ gui:
|
|||||||
- default
|
- default
|
||||||
selectedRangeBgColor:
|
selectedRangeBgColor:
|
||||||
- blue
|
- blue
|
||||||
|
cherryPickedCommitBgColor:
|
||||||
|
- blue
|
||||||
|
cherryPickedCommitFgColor:
|
||||||
|
- cyan
|
||||||
commitLength:
|
commitLength:
|
||||||
show: true
|
show: true
|
||||||
mouseEvents: true
|
mouseEvents: true
|
||||||
|
@ -50,6 +50,8 @@ type ThemeConfig struct {
|
|||||||
OptionsTextColor []string `yaml:"optionsTextColor"`
|
OptionsTextColor []string `yaml:"optionsTextColor"`
|
||||||
SelectedLineBgColor []string `yaml:"selectedLineBgColor"`
|
SelectedLineBgColor []string `yaml:"selectedLineBgColor"`
|
||||||
SelectedRangeBgColor []string `yaml:"selectedRangeBgColor"`
|
SelectedRangeBgColor []string `yaml:"selectedRangeBgColor"`
|
||||||
|
CherryPickedCommitBgColor []string `yaml:"cherryPickedCommitBgColor"`
|
||||||
|
CherryPickedCommitFgColor []string `yaml:"cherryPickedCommitFgColor"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CommitLengthConfig struct {
|
type CommitLengthConfig struct {
|
||||||
@ -319,6 +321,8 @@ func GetDefaultConfig() *UserConfig {
|
|||||||
OptionsTextColor: []string{"blue"},
|
OptionsTextColor: []string{"blue"},
|
||||||
SelectedLineBgColor: []string{"default"},
|
SelectedLineBgColor: []string{"default"},
|
||||||
SelectedRangeBgColor: []string{"blue"},
|
SelectedRangeBgColor: []string{"blue"},
|
||||||
|
CherryPickedCommitBgColor: []string{"blue"},
|
||||||
|
CherryPickedCommitFgColor: []string{"cyan"},
|
||||||
},
|
},
|
||||||
CommitLength: CommitLengthConfig{Show: true},
|
CommitLength: CommitLengthConfig{Show: true},
|
||||||
SkipNoStagedFilesWarning: false,
|
SkipNoStagedFilesWarning: false,
|
||||||
|
@ -10,8 +10,6 @@ import (
|
|||||||
"github.com/kyokomi/emoji/v2"
|
"github.com/kyokomi/emoji/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
var cherryPickedCommitTextStyle = style.FgCyan.MergeStyle(style.BgBlue)
|
|
||||||
|
|
||||||
func GetCommitListDisplayStrings(commits []*models.Commit, fullDescription bool, cherryPickedCommitShaMap map[string]bool, diffName string, parseEmoji bool) [][]string {
|
func GetCommitListDisplayStrings(commits []*models.Commit, fullDescription bool, cherryPickedCommitShaMap map[string]bool, diffName string, parseEmoji bool) [][]string {
|
||||||
lines := make([][]string, len(commits))
|
lines := make([][]string, len(commits))
|
||||||
|
|
||||||
@ -51,7 +49,7 @@ func getFullDescriptionDisplayStringsForCommit(c *models.Commit, cherryPickedCom
|
|||||||
// for some reason, setting the background to blue pads out the other commits
|
// for some reason, setting the background to blue pads out the other commits
|
||||||
// horizontally. For the sake of accessibility I'm considering this a feature,
|
// horizontally. For the sake of accessibility I'm considering this a feature,
|
||||||
// not a bug
|
// not a bug
|
||||||
shaColor = cherryPickedCommitTextStyle
|
shaColor = theme.CherryPickedCommitTextStyle
|
||||||
}
|
}
|
||||||
|
|
||||||
tagString := ""
|
tagString := ""
|
||||||
@ -98,7 +96,7 @@ func getDisplayStringsForCommit(c *models.Commit, cherryPickedCommitShaMap map[s
|
|||||||
// for some reason, setting the background to blue pads out the other commits
|
// for some reason, setting the background to blue pads out the other commits
|
||||||
// horizontally. For the sake of accessibility I'm considering this a feature,
|
// horizontally. For the sake of accessibility I'm considering this a feature,
|
||||||
// not a bug
|
// not a bug
|
||||||
shaColor = cherryPickedCommitTextStyle
|
shaColor = theme.CherryPickedCommitTextStyle
|
||||||
}
|
}
|
||||||
|
|
||||||
actionString := ""
|
actionString := ""
|
||||||
|
@ -29,7 +29,7 @@ func GetReflogCommitListDisplayStrings(commits []*models.Commit, fullDescription
|
|||||||
func coloredReflogSha(c *models.Commit, cherryPickedCommitShaMap map[string]bool) string {
|
func coloredReflogSha(c *models.Commit, cherryPickedCommitShaMap map[string]bool) string {
|
||||||
shaColor := style.FgBlue
|
shaColor := style.FgBlue
|
||||||
if cherryPickedCommitShaMap[c.Sha] {
|
if cherryPickedCommitShaMap[c.Sha] {
|
||||||
shaColor = cherryPickedCommitTextStyle
|
shaColor = theme.CherryPickedCommitTextStyle
|
||||||
}
|
}
|
||||||
|
|
||||||
return shaColor.Sprint(c.ShortSha())
|
return shaColor.Sprint(c.ShortSha())
|
||||||
|
@ -33,6 +33,9 @@ var (
|
|||||||
// SelectedRangeBgColor is the background color of the selected range of lines
|
// SelectedRangeBgColor is the background color of the selected range of lines
|
||||||
SelectedRangeBgColor = style.New()
|
SelectedRangeBgColor = style.New()
|
||||||
|
|
||||||
|
// CherryPickedCommitColor is the text style when cherry picking a commit
|
||||||
|
CherryPickedCommitTextStyle = style.New()
|
||||||
|
|
||||||
OptionsFgColor = style.New()
|
OptionsFgColor = style.New()
|
||||||
|
|
||||||
DiffTerminalColor = style.FgMagenta
|
DiffTerminalColor = style.FgMagenta
|
||||||
@ -44,6 +47,11 @@ func UpdateTheme(themeConfig config.ThemeConfig) {
|
|||||||
InactiveBorderColor = GetGocuiStyle(themeConfig.InactiveBorderColor)
|
InactiveBorderColor = GetGocuiStyle(themeConfig.InactiveBorderColor)
|
||||||
SelectedLineBgColor = GetTextStyle(themeConfig.SelectedLineBgColor, true)
|
SelectedLineBgColor = GetTextStyle(themeConfig.SelectedLineBgColor, true)
|
||||||
SelectedRangeBgColor = GetTextStyle(themeConfig.SelectedRangeBgColor, true)
|
SelectedRangeBgColor = GetTextStyle(themeConfig.SelectedRangeBgColor, true)
|
||||||
|
|
||||||
|
var cherryPickedCommitBgTextStyle = GetTextStyle(themeConfig.CherryPickedCommitBgColor, true)
|
||||||
|
var cherryPickedCommitFgTextStyle = GetTextStyle(themeConfig.CherryPickedCommitFgColor, false)
|
||||||
|
CherryPickedCommitTextStyle = cherryPickedCommitBgTextStyle.MergeStyle(cherryPickedCommitFgTextStyle)
|
||||||
|
|
||||||
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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user