FabGL2
2.0.0
Graphics, audio, GUI and retro-computing library for the ESP32 (ESP-IDF)
Toggle main menu visibility
Loading...
Searching...
No Matches
uitheme.h
Go to the documentation of this file.
1
/*
2
Created by Fabrizio Di Vittorio (fdivitto2013@gmail.com) - <http://www.fabgl.com>
3
Copyright (c) 2019-2026 Fabrizio Di Vittorio.
4
All rights reserved.
5
6
7
* Please contact fdivitto2013@gmail.com if you need a commercial license.
8
9
10
* This library and related software is available under GPL v3.
11
12
FabGL is free software: you can redistribute it and/or modify
13
it under the terms of the GNU General Public License as published by
14
the Free Software Foundation, either version 3 of the License, or
15
(at your option) any later version.
16
17
FabGL is distributed in the hope that it will be useful,
18
but WITHOUT ANY WARRANTY; without even the implied warranty of
19
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
GNU General Public License for more details.
21
22
You should have received a copy of the GNU General Public License
23
along with FabGL. If not, see <http://www.gnu.org/licenses/>.
24
*/
25
26
27
#pragma once
28
29
35
36
37
#include "
fabui.h
"
38
39
40
namespace
fabgl {
41
42
43
47
enum class
uiThemeInk
: uint8_t {
48
Black
,
49
Desktop
,
50
Green
,
51
Bloom1
,
52
AccentDark
,
53
Bloom2
,
54
Card
,
55
Border
,
56
TextDim
,
57
Red
,
58
Hover
,
59
Amber
,
60
Accent
,
61
Window
,
62
Text
,
63
White
,
64
};
65
66
70
enum class
uiThemeAccent
: uint8_t {
71
Orange
,
72
Cyan
,
73
Violet
,
74
Green
,
75
};
76
77
84
struct
uiThemeStyle
{
85
enum : uint32_t {
86
First = 1000,
87
Frame
= First,
88
Dialog
,
89
DialogFooter
,
90
Popup
,
91
Taskbar
,
92
Card
,
93
Label
,
94
LabelDim
,
95
LabelTitle
,
96
LabelBig
,
97
LabelDesktop
,
98
LabelValue
,
99
Button
,
100
ButtonAccent
,
101
ButtonFlat
,
102
Edit
,
103
ListBox
,
104
ComboBox
,
105
SplitButton
,
106
CheckBox
,
107
Slider
,
108
ProgressBar
,
109
PaintBox
,
110
Knob
,
111
ToggleSwitch
,
112
LevelBar
,
113
LedBar
,
114
Stepper
,
115
TileSelector
,
116
Graph
,
117
PianoKeyboard
,
118
Fader
,
119
Pad
,
120
SegmentDisplay
,
121
StepGrid
,
122
Last,
123
};
124
};
125
126
158
class
uiDarkTheme
:
public
uiStyle
{
159
160
public
:
161
167
uiDarkTheme
(
uiThemeAccent
accent
=
uiThemeAccent::Orange
);
168
174
uiThemeAccent
accent
() {
return
m_accent; }
175
183
RGB888
color
(
uiThemeInk
value);
184
195
RGB888
ink
(
uiThemeInk
value) {
return
m_paletted ? m_ink[(int) value] :
color
(value); }
196
206
template
<
typename
DisplayController>
207
void
setupPalette
(DisplayController * displayController) {
208
int
colors = preparePalette(displayController->colorsCount());
209
for
(
int
i = 0; i < colors; ++i)
210
displayController->setPaletteItem(i, paletteColor(i));
211
}
212
221
void
apply
(
uiApp
* app);
222
229
void
setStyle
(
uiObject
*
object
, uint32_t styleClassID);
230
238
uint32_t
defaultStyleClass
(
uiObject
*
object
);
239
240
static
FontInfo
const
*
smallFont
() {
return
&FONT_std_12; }
241
static
FontInfo
const
*
normalFont
() {
return
&FONT_std_14; }
242
static
FontInfo
const
*
titleFont
() {
return
&FONT_std_17; }
243
static
FontInfo
const
*
bigFont
() {
return
&FONT_std_24; }
244
245
246
protected
:
247
248
void
setBorder(
uiWindow
* window,
int
size,
RGB888
color
,
RGB888
focusedColor,
int
cornerRadius = 0);
249
void
setScrollBars(
uiScrollableControl
* control);
250
void
setListBox(
uiCustomListBox
* listBox);
251
void
setEdit(
uiTextEdit
* edit);
252
void
setButton(
uiButton
* button, uint32_t styleClassID);
253
void
setFrame(
uiFrame
* frame, uint32_t styleClassID,
bool
keepBorderSize);
254
void
setLabel(
uiObject
*
object
, uint32_t styleClassID);
255
void
setComboBox(
uiCustomComboBox
* comboBox);
256
257
int
preparePalette(
int
colors);
258
RGB888
paletteColor(
int
slot);
259
260
261
private
:
262
263
uiThemeAccent
m_accent;
264
bool
m_paletted;
265
int
m_paletteSize;
266
RGB888
m_ink[16];
// color to use for each uiThemeInk with the reprogrammed palette
267
268
};
269
270
271
272
}
// end of namespace
fabgl::uiApp
Represents the whole application base class.
Definition
fabui.h:5167
fabgl::uiButton
Represents a button control. A button can have text and optionally a bitmap.
Definition
fabui.h:1334
fabgl::uiCustomComboBox
This is a combination of a listbox and another component, base of all combobox components.
Definition
fabui.h:2479
fabgl::uiCustomListBox
Base class for list controls that display a list of selectable items.
Definition
fabui.h:2108
fabgl::uiDarkTheme::uiDarkTheme
uiDarkTheme(uiThemeAccent accent=uiThemeAccent::Orange)
Creates the theme.
Definition
uitheme.cpp:73
fabgl::uiDarkTheme::color
RGB888 color(uiThemeInk value)
Gets the actual RGB value of a theme color.
Definition
uitheme.cpp:131
fabgl::uiDarkTheme::normalFont
static FontInfo const * normalFont()
Definition
uitheme.h:241
fabgl::uiDarkTheme::bigFont
static FontInfo const * bigFont()
Definition
uitheme.h:243
fabgl::uiDarkTheme::setupPalette
void setupPalette(DisplayController *displayController)
Reprograms the palette of the display with the theme colors.
Definition
uitheme.h:207
fabgl::uiDarkTheme::defaultStyleClass
uint32_t defaultStyleClass(uiObject *object)
Gets the style class used for an element created without style class.
Definition
uitheme.cpp:161
fabgl::uiDarkTheme::apply
void apply(uiApp *app)
Applies the theme to an application.
Definition
uitheme.cpp:145
fabgl::uiDarkTheme::accent
uiThemeAccent accent()
Determines the accent color.
Definition
uitheme.h:174
fabgl::uiDarkTheme::smallFont
static FontInfo const * smallFont()
Definition
uitheme.h:240
fabgl::uiDarkTheme::setStyle
void setStyle(uiObject *object, uint32_t styleClassID)
Configures a UI element (called by the library).
Definition
uitheme.cpp:388
fabgl::uiDarkTheme::ink
RGB888 ink(uiThemeInk value)
Gets the color to use with the Canvas and the styles to obtain a theme color.
Definition
uitheme.h:195
fabgl::uiDarkTheme::titleFont
static FontInfo const * titleFont()
Definition
uitheme.h:242
fabgl::uiFrame
A frame is a window with a title bar, maximize/minimize/close buttons and that is resizable or movabl...
Definition
fabui.h:889
fabgl::uiObject
Base class of all UI elements like windows and controls.
Definition
fabui.h:315
fabgl::uiScrollableControl
A scrollable control is a control with optionally vertical and/or horizontal scrollbars.
Definition
fabui.h:1130
fabgl::uiTextEdit
Represents a text edit control.
Definition
fabui.h:1495
fabgl::uiWindow
Base class for all visible UI elements (Frames and Controls).
Definition
fabui.h:452
fabui.h
This file contains all classes related to FabGL Graphical User Interface.
fabgl::uiThemeInk
uiThemeInk
Colors of uiDarkTheme. Each one is a slot of the 16 color palette (see uiDarkTheme::setupPalette()).
Definition
uitheme.h:47
fabgl::uiThemeInk::Border
@ Border
Definition
uitheme.h:55
fabgl::uiThemeInk::AccentDark
@ AccentDark
Definition
uitheme.h:52
fabgl::uiThemeInk::Card
@ Card
Definition
uitheme.h:54
fabgl::uiThemeInk::Desktop
@ Desktop
Definition
uitheme.h:49
fabgl::uiThemeInk::Amber
@ Amber
Definition
uitheme.h:59
fabgl::uiThemeInk::Bloom1
@ Bloom1
Definition
uitheme.h:51
fabgl::uiThemeInk::Text
@ Text
Definition
uitheme.h:62
fabgl::uiThemeInk::TextDim
@ TextDim
Definition
uitheme.h:56
fabgl::uiThemeInk::Bloom2
@ Bloom2
Definition
uitheme.h:53
fabgl::uiThemeInk::Accent
@ Accent
Definition
uitheme.h:60
fabgl::uiThemeInk::Hover
@ Hover
Definition
uitheme.h:58
fabgl::uiThemeAccent
uiThemeAccent
Accent colors of uiDarkTheme.
Definition
uitheme.h:70
fabgl::uiThemeAccent::Violet
@ Violet
Definition
uitheme.h:73
fabgl::uiThemeAccent::Orange
@ Orange
Definition
uitheme.h:71
fabgl::Cyan
@ Cyan
Definition
displaycontroller.h:209
fabgl::White
@ White
Definition
displaycontroller.h:210
fabgl::Black
@ Black
Definition
displaycontroller.h:203
fabgl::Green
@ Green
Definition
displaycontroller.h:205
fabgl::Red
@ Red
Definition
displaycontroller.h:204
fabgl::uiOrigin::Window
@ Window
Definition
fabui.h:384
fabgl::FontInfo
Describes a bitmapped font.
Definition
fabutils.h:363
fabgl::RGB888
Represents a 24-bit RGB color.
Definition
displaycontroller.h:230
fabgl::uiStyle
Base class for application styles.
Definition
fabui.h:5060
fabgl::uiThemeStyle::Label
@ Label
Definition
uitheme.h:93
fabgl::uiThemeStyle::SplitButton
@ SplitButton
Definition
uitheme.h:105
fabgl::uiThemeStyle::LabelDesktop
@ LabelDesktop
Definition
uitheme.h:97
fabgl::uiThemeStyle::ButtonFlat
@ ButtonFlat
Definition
uitheme.h:101
fabgl::uiThemeStyle::Frame
@ Frame
Definition
uitheme.h:87
fabgl::uiThemeStyle::ProgressBar
@ ProgressBar
Definition
uitheme.h:108
fabgl::uiThemeStyle::Graph
@ Graph
Definition
uitheme.h:116
fabgl::uiThemeStyle::TileSelector
@ TileSelector
Definition
uitheme.h:115
fabgl::uiThemeStyle::Button
@ Button
Definition
uitheme.h:99
fabgl::uiThemeStyle::ButtonAccent
@ ButtonAccent
Definition
uitheme.h:100
fabgl::uiThemeStyle::LevelBar
@ LevelBar
Definition
uitheme.h:112
fabgl::uiThemeStyle::ToggleSwitch
@ ToggleSwitch
Definition
uitheme.h:111
fabgl::uiThemeStyle::LedBar
@ LedBar
Definition
uitheme.h:113
fabgl::uiThemeStyle::Slider
@ Slider
Definition
uitheme.h:107
fabgl::uiThemeStyle::PaintBox
@ PaintBox
Definition
uitheme.h:109
fabgl::uiThemeStyle::Dialog
@ Dialog
Definition
uitheme.h:88
fabgl::uiThemeStyle::LabelTitle
@ LabelTitle
Definition
uitheme.h:95
fabgl::uiThemeStyle::LabelDim
@ LabelDim
Definition
uitheme.h:94
fabgl::uiThemeStyle::LabelBig
@ LabelBig
Definition
uitheme.h:96
fabgl::uiThemeStyle::Card
@ Card
Definition
uitheme.h:92
fabgl::uiThemeStyle::Stepper
@ Stepper
Definition
uitheme.h:114
fabgl::uiThemeStyle::SegmentDisplay
@ SegmentDisplay
Definition
uitheme.h:120
fabgl::uiThemeStyle::StepGrid
@ StepGrid
Definition
uitheme.h:121
fabgl::uiThemeStyle::Popup
@ Popup
Definition
uitheme.h:90
fabgl::uiThemeStyle::CheckBox
@ CheckBox
Definition
uitheme.h:106
fabgl::uiThemeStyle::Knob
@ Knob
Definition
uitheme.h:110
fabgl::uiThemeStyle::Pad
@ Pad
Definition
uitheme.h:119
fabgl::uiThemeStyle::Fader
@ Fader
Definition
uitheme.h:118
fabgl::uiThemeStyle::DialogFooter
@ DialogFooter
Definition
uitheme.h:89
fabgl::uiThemeStyle::PianoKeyboard
@ PianoKeyboard
Definition
uitheme.h:117
fabgl::uiThemeStyle::ListBox
@ ListBox
Definition
uitheme.h:103
fabgl::uiThemeStyle::ComboBox
@ ComboBox
Definition
uitheme.h:104
fabgl::uiThemeStyle::LabelValue
@ LabelValue
Definition
uitheme.h:98
fabgl::uiThemeStyle::Edit
@ Edit
Definition
uitheme.h:102
fabgl::uiThemeStyle::Taskbar
@ Taskbar
Definition
uitheme.h:91
fabgl::uiThemeStyle
Style classes of uiDarkTheme.
Definition
uitheme.h:84
components
fabgl
src
uitheme.h
Generated on
for FabGL2 by
1.18.0