diff --git a/docs/Config.md b/docs/Config.md index f752e026b..bc860156c 100644 --- a/docs/Config.md +++ b/docs/Config.md @@ -88,7 +88,7 @@ git: # displays the whole git graph by default in the commits panel (equivalent to passing the `--all` argument to `git log`) showWholeGraph: false skipHookPrefix: WIP - # The main branches. We colour commits green if they belong to one of these branches, + # The main branches. We colour commits green if they belong to one of these branches, # so that you can easily see which commits are unique to your branch (coloured in yellow) mainBranches: [master, main] autoFetch: true @@ -347,6 +347,7 @@ The available attributes are: - default - reverse # useful for high-contrast - underline +- strikethrough ## Highlighting the selected line diff --git a/pkg/gui/style/decoration.go b/pkg/gui/style/decoration.go index f6fedb879..b5d95b645 100644 --- a/pkg/gui/style/decoration.go +++ b/pkg/gui/style/decoration.go @@ -3,9 +3,10 @@ package style import "github.com/gookit/color" type Decoration struct { - bold bool - underline bool - reverse bool + bold bool + underline bool + reverse bool + strikethrough bool } func (d *Decoration) SetBold() { @@ -20,6 +21,10 @@ func (d *Decoration) SetReverse() { d.reverse = true } +func (d *Decoration) SetStrikethrough() { + d.strikethrough = true +} + func (d Decoration) ToOpts() color.Opts { opts := make([]color.Color, 0, 3) @@ -35,6 +40,10 @@ func (d Decoration) ToOpts() color.Opts { opts = append(opts, color.OpReverse) } + if d.strikethrough { + opts = append(opts, color.OpStrikethrough) + } + return opts } @@ -51,5 +60,9 @@ func (d Decoration) Merge(other Decoration) Decoration { d.reverse = true } + if other.strikethrough { + d.strikethrough = true + } + return d } diff --git a/pkg/gui/style/text_style.go b/pkg/gui/style/text_style.go index 96d43a8f0..3eee68eff 100644 --- a/pkg/gui/style/text_style.go +++ b/pkg/gui/style/text_style.go @@ -98,6 +98,12 @@ func (b TextStyle) SetReverse() TextStyle { return b } +func (b TextStyle) SetStrikethrough() TextStyle { + b.decoration.SetStrikethrough() + b.Style = b.deriveStyle() + return b +} + func (b TextStyle) SetBg(color Color) TextStyle { b.bg = &color b.Style = b.deriveStyle() diff --git a/pkg/theme/style.go b/pkg/theme/style.go index f090068e0..43e81315d 100644 --- a/pkg/theme/style.go +++ b/pkg/theme/style.go @@ -17,6 +17,8 @@ func GetTextStyle(keys []string, background bool) style.TextStyle { s = s.SetReverse() case "underline": s = s.SetUnderline() + case "strikethrough": + s = s.SetStrikethrough() default: value, present := style.ColorMap[key] if present {