mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-05 01:15:35 +00:00
widget/material: allow configuring default typeface on theme
This commit introduces the material.Theme.Face field, which will automatically populate the Font.Typeface in every text widget created using a constructor function in package material. Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
This commit is contained in:
@@ -105,13 +105,15 @@ func Overline(th *Theme, txt string) LabelStyle {
|
||||
}
|
||||
|
||||
func Label(th *Theme, size unit.Sp, txt string) LabelStyle {
|
||||
return LabelStyle{
|
||||
l := LabelStyle{
|
||||
Text: txt,
|
||||
Color: th.Palette.Fg,
|
||||
SelectionColor: f32color.MulAlpha(th.Palette.ContrastBg, 0x60),
|
||||
TextSize: size,
|
||||
Shaper: th.Shaper,
|
||||
}
|
||||
l.Font.Typeface = th.Face
|
||||
return l
|
||||
}
|
||||
|
||||
func (l LabelStyle) Layout(gtx layout.Context) layout.Dimensions {
|
||||
|
||||
Reference in New Issue
Block a user