Changed colors of button text a bit.

This commit is contained in:
Sander Schobers 2020-12-12 14:46:06 +01:00
parent f4827fa200
commit c2e688cc68

View File

@ -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)
}
}