Changed colors of button text a bit.

This commit is contained in:
Sander Schobers 2020-12-12 14:46:06 +01:00
parent 7d5168614e
commit b1cdbea90f

View File

@ -155,6 +155,13 @@ func (b *Button) fillColor(p *Palette) color.Color {
return nil 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 { func (b *Button) textColor(p *Palette) color.Color {
if b.Disabled { if b.Disabled {
if b.Background != nil { if b.Background != nil {
@ -166,22 +173,19 @@ func (b *Button) textColor(p *Palette) color.Color {
} }
return b.disabledColor(p) return b.disabledColor(p)
} }
if b.Font.Color != nil {
return b.Font.Color
}
switch b.Type { switch b.Type {
case ButtonTypeContained: case ButtonTypeContained:
return p.TextOnPrimary return b.fontColor(p.TextOnPrimary)
case ButtonTypeIcon: case ButtonTypeIcon:
if b.over { if b.over {
if b.HoverColor != nil { if b.HoverColor != nil {
return b.HoverColor return b.HoverColor
} }
return p.Primary return b.fontColor(p.Primary)
} }
return p.Text return b.fontColor(p.Text)
default: default:
return p.Primary return b.fontColor(p.Primary)
} }
} }