@@ 179,7 179,7 @@ type (
func uiMain() {
theme = material.NewTheme(gofont.Collection())
- theme.Color.Primary = rgb(0x3c98c6)
+ theme.ContrastBg = rgb(0x3c98c6)
iconLib.create = mustIcon(icons.ContentCreate)
iconLib.send = mustIcon(icons.ContentSend)
go func() {
@@ 399,12 399,12 @@ func mustLoadFont(fontData []byte) *sfnt.Font {
return fnt
}
-func rgb(c uint32) color.RGBA {
+func rgb(c uint32) color.NRGBA {
return argb((0xff << 24) | c)
}
-func argb(c uint32) color.RGBA {
- return color.RGBA{A: uint8(c >> 24), R: uint8(c >> 16), G: uint8(c >> 8), B: uint8(c)}
+func argb(c uint32) color.NRGBA {
+ return color.NRGBA{A: uint8(c >> 24), R: uint8(c >> 16), G: uint8(c >> 8), B: uint8(c)}
}
func (a *App) Layout(gtx layout.Context) {
@@ 512,7 512,7 @@ func (p *contactsPage) Layout(gtx layout.Context) layout.Dimensions {
}
l := p.list
if l.Dragging() {
- key.HideInputOp{}.Add(gtx.Ops)
+ key.SoftKeyboardOp{Show: false}.Add(gtx.Ops)
}
return layout.Flex{Axis: layout.Vertical}.Layout(gtx,
layout.Rigid(func(gtx C) D {
@@ 551,7 551,7 @@ func (p *contactsPage) contact(gtx layout.Context, index int) layout.Dimensions
return cc.Layout(gtx, func(gtx C) D {
sz := image.Point{X: gtx.Px(unit.Dp(48)), Y: gtx.Px(unit.Dp(48))}
gtx.Constraints = layout.Exact(gtx.Constraints.Constrain(sz))
- return fill{theme.Color.Primary}.Layout(gtx)
+ return fill{theme.ContrastBg}.Layout(gtx)
})
})
}),
@@ 580,7 580,7 @@ func (t *Topbar) Layout(gtx layout.Context, insets layout.Inset, w layout.Widget
Right: unit.Max(gtx.Metric, insets.Right, unit.Dp(16)),
}
return layout.Stack{Alignment: layout.SW}.Layout(gtx,
- layout.Expanded(fill{theme.Color.Primary}.Layout),
+ layout.Expanded(fill{theme.ContrastBg}.Layout),
layout.Stacked(func(gtx C) D {
return insets.Layout(gtx, func(gtx C) D {
return layout.Flex{Alignment: layout.Middle}.Layout(gtx,
@@ 702,7 702,7 @@ func (f *formField) Layout(gtx layout.Context) layout.Dimensions {
}
type Background struct {
- Color color.RGBA
+ Color color.NRGBA
Radius unit.Value
Inset layout.Inset
}
@@ 822,7 822,7 @@ func (p *threadsPage) Layout(gtx layout.Context) layout.Dimensions {
func (p *threadsPage) layoutThreads(gtx layout.Context) layout.Dimensions {
l := p.list
if l.Dragging() {
- key.HideInputOp{}.Add(gtx.Ops)
+ key.SoftKeyboardOp{Show: false}.Add(gtx.Ops)
}
return l.Layout(gtx, len(p.threads), func(gtx C, i int) D {
in := layout.Inset{}
@@ 838,7 838,7 @@ func (p *threadsPage) layoutThreads(gtx layout.Context) layout.Dimensions {
})
}
-var contactColors = []color.RGBA{
+var contactColors = []color.NRGBA{
{A: 0xff, R: 0xef, G: 0x6c, B: 0x00},
{A: 0xff, R: 0x00, G: 0x57, B: 0x9b},
{A: 0xff, R: 0x00, G: 0x97, B: 0xa7},
@@ 852,7 852,7 @@ func (p *threadsPage) thread(gtx layout.Context, index int) layout.Dimensions {
bgtexcol := rgb(0xbbbbbb)
fontWeight := text.Normal
if t.Unread > 0 {
- bgtexcol = theme.Color.Text
+ bgtexcol = theme.Fg
fontWeight = text.Bold
}
click := &p.clicks[index]
@@ 1006,7 1006,7 @@ func (p *threadPage) sendMessage() {
func (p *threadPage) Layout(gtx layout.Context) layout.Dimensions {
l := p.list
if l.Dragging() {
- key.HideInputOp{}.Add(gtx.Ops)
+ key.SoftKeyboardOp{Show: false}.Add(gtx.Ops)
}
select {
case p.messages = <-p.result:
@@ 1092,13 1092,13 @@ func (p *threadPage) message(gtx layout.Context, index int) layout.Dimensions {
in := layout.Inset{Top: unit.Dp(16), Left: unit.Dp(16), Right: unit.Dp(40)}
align := layout.W
msgCol := rgb(0xffffff)
- bgcol := theme.Color.Primary
+ bgcol := theme.ContrastBg
timecol := argb(0xaaaaaaaa)
if msg.Own {
in.Left, in.Right = in.Right, in.Left
align = layout.E
bgcol = rgb(0xeeeeee)
- msgCol = theme.Color.Text
+ msgCol = theme.Fg
timecol = rgb(0x888888)
}
in.Left = unit.Max(gtx.Metric, in.Left, p.env.insets.Left)
@@ 1209,7 1209,7 @@ func (a *App) update(gtx layout.Context) {
}
type fill struct {
- color color.RGBA
+ color color.NRGBA
}
func (f fill) Layout(gtx layout.Context) layout.Dimensions {
@@ 1257,7 1257,7 @@ func toPointF(p image.Point) f32.Point {
return f32.Point{X: float32(p.X), Y: float32(p.Y)}
}
-func (ic *icon) image(c unit.Metric, col color.RGBA) paint.ImageOp {
+func (ic *icon) image(c unit.Metric, col color.NRGBA) paint.ImageOp {
sz := c.Px(ic.size)
if sz == ic.imgSize {
return ic.op
@@ 1267,7 1267,7 @@ func (ic *icon) image(c unit.Metric, col color.RGBA) paint.ImageOp {
img := image.NewRGBA(image.Rectangle{Max: image.Point{X: sz, Y: int(float32(sz) * dy / dx)}})
var ico iconvg.Rasterizer
ico.SetDstImage(img, img.Bounds(), draw.Src)
- m.Palette[0] = col
+ m.Palette[0] = color.RGBAModel.Convert(col).(color.RGBA)
iconvg.Decode(&ico, ic.src, &iconvg.DecodeOptions{
Palette: &m.Palette,
})