From c2e688cc682b3632c21da487e6c67ca079cef3fe Mon Sep 17 00:00:00 2001 From: Sander Schobers Date: Sat, 12 Dec 2020 14:46:06 +0100 Subject: [PATCH] Changed colors of button text a bit. --- ui/button.go | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/ui/button.go b/ui/button.go index f22134e..673cefe 100644 --- a/ui/button.go +++ b/ui/button.go @@ -155,6 +155,13 @@ func (b *Button) fillColor(p *Palette) color.Color { return nil } +func (b *Button) fontColor(c color.Color) color.Color { + if b.Font.Color == nil { + return c + } + return b.Font.Color +} + func (b *Button) textColor(p *Palette) color.Color { if b.Disabled { if b.Background != nil { @@ -166,22 +173,19 @@ func (b *Button) textColor(p *Palette) color.Color { } return b.disabledColor(p) } - if b.Font.Color != nil { - return b.Font.Color - } switch b.Type { case ButtonTypeContained: - return p.TextOnPrimary + return b.fontColor(p.TextOnPrimary) case ButtonTypeIcon: if b.over { if b.HoverColor != nil { return b.HoverColor } - return p.Primary + return b.fontColor(p.Primary) } - return p.Text + return b.fontColor(p.Text) default: - return p.Primary + return b.fontColor(p.Primary) } }