diff --git a/ui/text/editor.go b/ui/text/editor.go index 9dacacb2..d4365d4f 100644 --- a/ui/text/editor.go +++ b/ui/text/editor.go @@ -4,6 +4,7 @@ package text import ( "image" + "image/color" "math" "time" "unicode/utf8" @@ -203,9 +204,12 @@ func (e *Editor) Layout(ops *ui.Ops, cs layout.Constraints) layout.Dimens { Offset: off, } ui.PushOp{}.Add(ops) + // Apply material. Set a default color in case the material is empty. if e.rr.len() > 0 { + draw.ColorOp{Col: color.RGBA{A: 0xff}}.Add(ops) e.Material.Add(ops) } else { + draw.ColorOp{Col: color.RGBA{A: 0xaa}}.Add(ops) e.HintMaterial.Add(ops) } for { diff --git a/ui/text/label.go b/ui/text/label.go index 3684310c..32e3342a 100644 --- a/ui/text/label.go +++ b/ui/text/label.go @@ -4,6 +4,7 @@ package text import ( "image" + "image/color" "math" "unicode/utf8" @@ -109,6 +110,8 @@ func (l Label) Layout(ops *ui.Ops, cs layout.Constraints) layout.Dimens { ui.PushOp{}.Add(ops) ui.TransformOp{Transform: ui.Offset(off)}.Add(ops) l.Face.Path(str).Add(ops) + // Set a default color in case the material is empty. + draw.ColorOp{Col: color.RGBA{A: 0xff}}.Add(ops) l.Material.Add(ops) draw.DrawOp{Rect: lclip}.Add(ops) ui.PopOp{}.Add(ops)