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

36 lines
467 B
Go

package style
import "github.com/gookit/color"
type Color struct {
rgb *color.RGBColor
basic *color.Color
}
func NewRGBColor(cl color.RGBColor) Color {
c := Color{}
c.rgb = &cl
return c
}
func NewBasicColor(cl color.Color) Color {
c := Color{}
c.basic = &cl
return c
}
func (c *Color) IsRGB() bool {
return c.rgb != nil
}
func (c *Color) ToRGB() Color {
if c.IsRGB() {
return *c
}
rgb := c.basic.RGB()
c.rgb = &rgb
return NewRGBColor(rgb)
}