1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-03-03 15:02:52 +02:00
lazygit/pkg/gui/style/decoration.go

54 lines
755 B
Go
Raw Normal View History

2021-07-31 12:54:28 +10:00
package style
import "github.com/gookit/color"
type Decoration struct {
bold bool
underline bool
reverse bool
}
func (d Decoration) SetBold() {
d.bold = true
}
func (d Decoration) SetUnderline() {
d.underline = true
}
func (d Decoration) SetReverse() {
d.reverse = true
}
func (d Decoration) ToOpts() color.Opts {
opts := make([]color.Color, 0, 3)
if d.bold {
opts = append(opts, color.OpBold)
}
if d.underline {
opts = append(opts, color.OpUnderscore)
}
if d.reverse {
opts = append(opts, color.OpReverse)
}
return opts
}
func (d Decoration) Merge(other Decoration) Decoration {
if other.bold {
d.bold = true
}
if other.underline {
d.underline = true
}
if other.reverse {
d.reverse = true
}
return d
}