Theme Switch
How to switch between light and dark mode with ui.ThemeSwitcher wrapped around any button.
package main
import (
_ "embed"
"go.wdy.de/nago/application"
"go.wdy.de/nago/presentation/core"
"go.wdy.de/nago/presentation/ui"
"go.wdy.de/nago/web/vuejs"
)
func main() {
application.Configure(func(cfg *application.Configurator) {
cfg.SetApplicationID("de.worldiety.tutorial_102")
cfg.Serve(vuejs.Dist())
cfg.RootView(".", func(wnd core.Window) core.View {
return ui.VStack(
ui.ThemeSwitcher(ui.SecondaryButton(nil).Title("THEME SWITCH")),
).Padding(ui.Padding{}.All(ui.L16)).Frame(ui.Frame{}.MatchScreen())
})
}).Run()
}
View on GitHub ↗
· run it with go run go.wdy.de/nago/example/cmd/tutorial-102-theme-switch@latest