package main import ( "image/color" "log" "os" "gioui.org/app" "gioui.org/font/gofont" "gioui.org/io/system" "gioui.org/layout" "gioui.org/op" "gioui.org/text" "gioui.org/unit" "gioui.org/widget/material" ) type Limox struct { ConnState string Ui struct { Window *app.Window } } func main() { limox := NewLimox() go func() { err := limox.run() if err != nil { log.Fatal(err) } os.Exit(0) }() app.Main() } func NewLimox() Limox { limox := Limox{} limox.Ui.Window = app.NewWindow( app.Title("LimoX"), app.Size(unit.Dp(400), unit.Dp(600)), ) limox.ConnState = "disconnected" return limox } func (l *Limox) run() error { th := material.NewTheme(gofont.Collection()) var ops op.Ops for { e := <-l.Ui.Window.Events() switch e := e.(type) { case system.DestroyEvent: return e.Err case system.FrameEvent: gtx := layout.NewContext(&ops, e) title := material.H3(th, l.ConnState) maroon := color.NRGBA{R: 0, G: 212, B: 0, A: 255} title.Color = maroon title.Alignment = text.Middle title.Layout(gtx) e.Frame(gtx.Ops) } } }