Styles and Themes Support #3
Etiķetes
Nav etiķešu
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
Nav atskaites punktu
Nav atbildīgo
1 dalībnieki
Paziņojumi
Izpildes termiņš
Izpildes termiņš nav uzstādīts.
Atkarības
Nav atkarību.
Atsaucas uz: go/ui#3
Notiek ielāde…
Atsaukties uz šo jaunā problēmā
Vēl nav satura.
Dzēst atzaru "%!s(<nil>)"
Atzara dzēšana ir neatgriezeniska, kā arī tā ir NEATGRIEZENISKA. Vai turpināt?
Ideas how to add styles and themes to the UI toolkit.
Basic Overview
Themes and styles should be a sub-package of ui, i.e. at go/ui/style.
Each widget that supports styles will define a .SetStyle() function that will take a widget-specific struct with options relevant to the widget.
A Theme will be a struct with pointers to default styles for all supported widgets. A nil value means that widget is not styled by the theme and the widget should use its own defaults.
Struct Examples
Setting a Theme
Probably have the theme be a global ui package variable that can be changed. New widgets created after a theme change will use the theme when they first style themselves.
ui.SetTheme(style.Theme)
When a widget needs its style info the logic should be:
Default Styles
Provide some Bootstrap-style default styles for buttons, to easily mark a button as "primary", "secondary", "success", "info", "warning" and "danger".
btn.SetStyle(style.ButtonPrimary)
Maybe styles like this can be functions that return their style dynamically, so it can take your theme's style and just set the background color as needed and return it, making it usable for custom themes.
Default Themes
Include a few default built-in themes, like: