One complete set of colors: a color for every SchemeColorRole.
More...
#include <headers/guillaume/theme.hpp>
|
|
| Scheme (void)=default |
| | Create a scheme in which every role has a default-constructed, unnamed color.
|
| | Scheme (const std::array< ExtendedColor, static_cast< std::size_t >(SchemeColorRole::Count)> &colors) |
| | Create a scheme from a full set of colors.
|
|
| ~Scheme (void)=default |
| | Default destructor.
|
| const ExtendedColor & | getColor (SchemeColorRole role) const |
| | Get the color of a role, with its name and description.
|
| ExtendedColor & | getColor (SchemeColorRole role) |
| | Get the color of a role, to modify it in place.
|
| void | setColor (SchemeColorRole role, const ExtendedColor &color) |
| | Replace the color of a role, with its name and description.
|
| void | setColor (SchemeColorRole role, const utility::graphic::Color32Bit &color, const std::string &name="", const std::string &description="", bool harmonized=false) |
| | Replace the color of a role from a plain color value.
|
| const auto & | getColors (void) const |
| | Get every color of the scheme.
|
One complete set of colors: a color for every SchemeColorRole.
A Theme holds six schemes (ThemeSchemeRole). Widgets read the active one through getActiveColor(). To change a color, edit the scheme in a copy of the theme and activate the copy:
.setColor(guillaume::SchemeColorRole::Primary,
utility::graphic::Color32Bit(0, 106, 106, 255));
Every design token of the UI in one object: colors, type scale, corner shapes, elevation,...
Design tokens: colors, type scale, shapes, elevation, motion and spacing. Read them through guillaume...
@ Light
Light scheme, standard contrast.
const Theme & getActiveTheme(void)
Get the theme every widget and system reads its tokens from.
void setActiveTheme(const Theme &theme)
Replace the active theme by a copy of another theme.
- See also
- Theme
-
getActiveScheme
Definition at line 262 of file theme.hpp.
◆ Scheme()
Create a scheme from a full set of colors.
- Parameters
-
◆ getColor() [1/2]
Get the color of a role, to modify it in place.
- Parameters
-
- Returns
- Mutable reference to the color of that role.
◆ getColor() [2/2]
Get the color of a role, with its name and description.
- Parameters
-
- Returns
- The color of that role; call getColor() on it for the value to draw with.
◆ getColors()
| const auto & guillaume::Scheme::getColors |
( |
void | | ) |
const |
Get every color of the scheme.
- Returns
- The array of colors, indexed by SchemeColorRole.
- Note
- The return type is deduced and the function is defined in theme.cpp, so it can only be called from that file. Use getColor() elsewhere.
◆ setColor() [1/2]
Replace the color of a role, with its name and description.
- Parameters
-
◆ setColor() [2/2]
| void guillaume::Scheme::setColor |
( |
SchemeColorRole | role, |
|
|
const utility::graphic::Color32Bit & | color, |
|
|
const std::string & | name = "", |
|
|
const std::string & | description = "", |
|
|
bool | harmonized = false ) |
Replace the color of a role from a plain color value.
The name, the description and the harmonized flag of the role are replaced too, by the arguments or their defaults.
- Parameters
-
| role | The role to change. Must not be SchemeColorRole::Count. |
| color | The new color, 8 bits per RGBA channel. |
| name | The name of the color; empty by default. |
| description | What the color is for; empty by default. |
| harmonized | True when the color was shifted toward the theme's source color. |
The documentation for this class was generated from the following file: