The shades of one color family, from black (tone 0) to white (tone 100).
More...
#include <headers/guillaume/theme.hpp>
|
| enum class | Tone : std::uint8_t {
T0 = 0
, T10 = 10
, T20 = 20
, T30 = 30
,
T40 = 40
, T50 = 50
, T60 = 60
, T70 = 70
,
T80 = 80
, T90 = 90
, T100 = 100
} |
| | The tones a palette can hold. The number is the lightness: 0 is black, 100 is white. More...
|
|
|
| Palette (void) |
| | Create a palette with no name and no tone.
|
| | Palette (const std::string &name, const std::string &description) |
| | Create a palette with a name and no tone.
|
|
| ~Palette (void)=default |
| | Default destructor.
|
| const std::string & | getName (void) const |
| | Get the name of the palette.
|
| const std::string & | getDescription (void) const |
| | Get the text describing what the palette is for.
|
| const std::map< Tone, ExtendedColor > & | getTones (void) const |
| | Get every tone defined in the palette.
|
| void | setName (const std::string &name) |
| | Replace the name of the palette.
|
| void | setDescription (const std::string &description) |
| | Replace the text describing what the palette is for.
|
| void | setTone (Tone tone, const ExtendedColor &color) |
| | Define a tone, replacing the color it already has, if any.
|
| void | setTone (Tone tone, const utility::graphic::Color32Bit &color, const std::string &name="", const std::string &description="", bool harmonized=false) |
| | Define a tone from a plain color value, replacing the color it already has, if any.
|
| bool | hasTone (Tone tone) const |
| | Tell whether a tone is defined.
|
| const ExtendedColor & | getTone (Tone tone) const |
| | Get the color of a tone.
|
| void | removeTone (Tone tone) |
| | Undefine a tone. Does nothing when it is not defined.
|
|
void | clearTones (void) |
| | Undefine every tone of the palette.
|
The shades of one color family, from black (tone 0) to white (tone 100).
A Theme holds five palettes (ThemePaletteRole). They are reference data: widgets read scheme colors, not tones. A palette starts empty; tones are added with setTone().
- See also
- Theme::getPalette
Definition at line 363 of file theme.hpp.
◆ Tone
The tones a palette can hold. The number is the lightness: 0 is black, 100 is white.
| Enumerator |
|---|
| T0 | Black.
|
| T10 | Lightness 10.
|
| T20 | Lightness 20.
|
| T30 | Lightness 30.
|
| T40 | Lightness 40.
|
| T50 | Lightness 50.
|
| T60 | Lightness 60.
|
| T70 | Lightness 70.
|
| T80 | Lightness 80.
|
| T90 | Lightness 90.
|
| T100 | White.
|
Definition at line 370 of file theme.hpp.
◆ Palette()
| guillaume::Palette::Palette |
( |
const std::string & | name, |
|
|
const std::string & | description ) |
Create a palette with a name and no tone.
- Parameters
-
| name | The name of the palette, such as "Neutral". |
| description | What the palette is for; may be empty. |
◆ getDescription()
| const std::string & guillaume::Palette::getDescription |
( |
void | | ) |
const |
Get the text describing what the palette is for.
- Returns
- The description; empty when none was given.
◆ getName()
| const std::string & guillaume::Palette::getName |
( |
void | | ) |
const |
Get the name of the palette.
- Returns
- The name; empty when none was given.
◆ getTone()
Get the color of a tone.
- Parameters
-
- Returns
- The color of that tone.
- Exceptions
-
| std::out_of_range | When the tone is not defined. Check with hasTone() first when unsure. |
◆ getTones()
Get every tone defined in the palette.
- Returns
- The tones, ordered from the darkest to the lightest; empty when none was set.
◆ hasTone()
| bool guillaume::Palette::hasTone |
( |
Tone | tone | ) |
const |
Tell whether a tone is defined.
- Parameters
-
| tone | The tone to look for. |
- Returns
- True when setTone() was called for that tone and it was not removed since.
◆ removeTone()
| void guillaume::Palette::removeTone |
( |
Tone | tone | ) |
|
Undefine a tone. Does nothing when it is not defined.
- Parameters
-
◆ setDescription()
| void guillaume::Palette::setDescription |
( |
const std::string & | description | ) |
|
Replace the text describing what the palette is for.
- Parameters
-
| description | The new description; may be empty. |
◆ setName()
| void guillaume::Palette::setName |
( |
const std::string & | name | ) |
|
Replace the name of the palette.
- Parameters
-
◆ setTone() [1/2]
Define a tone, replacing the color it already has, if any.
- Parameters
-
| tone | The tone to define. |
| color | The color of that tone and its documentation. |
◆ setTone() [2/2]
| void guillaume::Palette::setTone |
( |
Tone | tone, |
|
|
const utility::graphic::Color32Bit & | color, |
|
|
const std::string & | name = "", |
|
|
const std::string & | description = "", |
|
|
bool | harmonized = false ) |
Define a tone from a plain color value, replacing the color it already has, if any.
- Parameters
-
| tone | The tone to define. |
| color | The color of that tone, 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: