diff --git a/main.go b/main.go index d3269c2..61574d6 100644 --- a/main.go +++ b/main.go @@ -86,11 +86,13 @@ func Align(x text.Alignment) AlignOpt { return AlignOpt { x } } type LabelOpts struct { FaceOpt + c *color.RGBA AlignOpt } type LabelOption interface { DoLabelOption(*LabelOpts) } func (x FaceOpt) DoLabelOption(o *LabelOpts) { o.face = x.face } func (x AlignOpt) DoLabelOption(o *LabelOpts) { o.alignment = x.alignment } +func (x ColorOpt) DoLabelOption(o *LabelOpts) { o.c = &x.c; } func NewLabel(t string, lops ...LabelOption) *Label { ret := &Label{} @@ -101,6 +103,12 @@ func NewLabel(t string, lops ...LabelOption) *Label { Text: t, Alignment: opts.alignment, } + if opts.c != nil { // got a color option... + ops := new(ui.Ops) + ret.l.Material.Record(ops) + paint.ColorOp{Color: *opts.c}.Add(ops) + ret.l.Material.Stop() + } return ret }