1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-12-12 11:15:00 +02:00
lazygit/pkg/gui/style/decoration.go
2021-07-31 17:33:13 +10:00

54 lines
755 B
Go

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
}