|
FabGL2 2.0.0
Graphics, audio, GUI and retro-computing library for the ESP32 (ESP-IDF)
|
A ready to use dark flat theme: near black surfaces, thin gray lines and a colored accent. More...
#include <uitheme.h>

Public Member Functions | |
| uiDarkTheme (uiThemeAccent accent=uiThemeAccent::Orange) | |
| Creates the theme. | |
| uiThemeAccent | accent () |
| Determines the accent color. | |
| void | apply (uiApp *app) |
| Applies the theme to an application. | |
| RGB888 | color (uiThemeInk value) |
| Gets the actual RGB value of a theme color. | |
| uint32_t | defaultStyleClass (uiObject *object) |
| Gets the style class used for an element created without style class. | |
| RGB888 | ink (uiThemeInk value) |
| Gets the color to use with the Canvas and the styles to obtain a theme color. | |
| void | setStyle (uiObject *object, uint32_t styleClassID) |
| Configures a UI element (called by the library). | |
| template<typename DisplayController> | |
| void | setupPalette (DisplayController *displayController) |
| Reprograms the palette of the display with the theme colors. | |
Static Public Member Functions | |
| static FontInfo const * | bigFont () |
| static FontInfo const * | normalFont () |
| static FontInfo const * | smallFont () |
| static FontInfo const * | titleFont () |
Public Attributes | |
| bool | applyToUnstyled = false |
| When true setStyle() is called also for the UI elements created without a style class (styleClassID = 0). | |
A ready to use dark flat theme: near black surfaces, thin gray lines and a colored accent.
It is made for 16 color displays (VGA16Controller, CVBS16Controller): setupPalette() reprograms the palette with the theme colors (slots chosen so that the mouse pointer and the message box icons keep their colors). The colors are on the grid of the VGA output (2 bits per channel: 0, 85, 170, 255). Without setupPalette() (for example to keep the standard 16 colors) or on other displays the theme colors are approximated by the display.
Usage:
static fabgl::uiDarkTheme theme; // optionally: theme(fabgl::uiThemeAccent::Violet)
class MyApp : public uiApp {
void init() {
theme.apply(this);
// controls created without style class get the theme by type
new uiButton(rootWindow(), "OK", Point(10, 10), Size(80, 24));
// style classes select the variants
new uiStaticLabel(rootWindow(), "Title", Point(10, 40), true, fabgl::uiThemeStyle::LabelTitle);
}
} app;
DisplayController.setResolution(VGA_640x480_60Hz);
theme.setupPalette(&DisplayController); // before the application creates its windows
app.run(&DisplayController);
Use ink() to paint with the theme colors (onPaint handlers, uiPaintBox). Derive from it to add style classes (lower than uiThemeStyle::First) and call uiDarkTheme::setStyle() for the others.