Theme struct
#include <Jazz2/UI/Windows/Theme.h>
Colors and sizes of the interface.
Sizes are in units, which the interface scale turns into pixels. Text colors are as UI::
The colors change with the theme, see Apply(). A color copied from them before — an element keeps the color of its text, for example — is still drawn in the color of the theme, Painter looks it up by its default value, see Resolve().
Things shown over the level — what is right or wrong, links, teams — take the overlay colors.
Public static variables
- static bool ReducedMotion
- Whether animations of the interface are left out, set by Apply().
- static bool ReadableFont
- Whether text is in the readable font instead of the pixel font of the game, set by Apply().
-
static std::
uint32_t FontVersion - Changes whenever text is measured in another font, set by Apply().
Public static functions
- static void Apply(ThemeKind kind, bool reducedMotion, bool readableFont)
- Sets the colors of a theme, whether animations are left out and the font.
- static auto GetKind() -> ThemeKind
- Returns the theme in use.
- static auto Resolve(const Colorf& color) -> Colorf
- Returns the color of the current theme for a color of the default one.
- static auto GetAnimationStep(float timeMult, float frames) -> float
- Returns how far an animation of a number of frames moves in a frame, all of the way if motion is reduced.
- static auto GetTextScale(float scale) -> float
- Returns the size text is drawn at for a scale of the interface.
- static auto IsTextScaleWhole(float scale) -> bool
- Returns
trueif text drawn at the scale of the interface is at a whole multiple of the size of the font.
Colors
- static Colorf PanelFill
- static Colorf PanelFillAlt
- static Colorf PanelBorder
- static Colorf PanelBorderDim
- static Colorf PanelHeader
- static Colorf Shadow
- static Colorf Separator
- static Colorf ButtonFill
- static Colorf ButtonHover
- static Colorf ButtonPressed
- static Colorf ButtonChecked
- static Colorf ButtonCheckedHover
- static Colorf ButtonOutline
- static Colorf Accent
- static Colorf AccentDim
- static Colorf Selection
- static Colorf Hover
- static Colorf InputFill
- static Colorf InputBorder
- static Colorf FocusRing
- static Colorf Play
- static Colorf Danger
- static Colorf IconColor
- static Colorf IconDisabled
- static Colorf GridLine
- static Colorf GridLineStrong
- static Colorf Cursor
- static float BackdropFillOpacity constexpr
- How much of the opacity of the background of a panel is kept over a blurred picture of the level, see Painter::
Backdrop(). - static float BackdropWindowFillOpacity constexpr
- How much of the opacity of the background of a window, a menu or a message is kept over a blurred picture of what is behind it.
Text colors
The font tints its gray glyphs by 1 + (color - 0.5) * 4, so 0.5 is the glyph as it is and opaque and anything much above 0.6 glares. The colors above are toned down when they're used for a text, see Painter::
- static Colorf Text
- static Colorf TextDim
- static Colorf TextDisabled
- static Colorf TextHeader
- static Colorf TextOnAccent
- static Colorf TextAccent
- static Colorf TextDanger
- static Colorf TextWarning
- static Colorf TextPlay
Overlay colors
For what is shown over the level.
- static Colorf OverlayGood
- What is right, reachable, allowed.
- static Colorf OverlayBad
- What is wrong, unreachable, blocked.
- static Colorf OverlayCaution
- What needs attention.
- static Colorf OverlayInfo
- What is only pointed out, links between things.
- static Colorf OverlaySeries
- Colors of things told apart only by their color, such as the teams, in this order: blue, red, green, yellow.
Sizes in units
- static float TextScale constexpr
- Size of text relative to the interface scale.
- static float Padding constexpr
- static float Spacing constexpr
- static float CornerRadius constexpr
- static float RowHeight constexpr
- static float ButtonHeight constexpr
- static float IconSize constexpr
- static float MenuBarHeight constexpr
- static float ToolbarHeight constexpr
- static float StatusBarHeight constexpr
- static float ScrollBarWidth constexpr
- static float ShadowSize constexpr
Function documentation
static Colorf Jazz2:: UI:: Windows:: Theme:: Resolve(const Colorf& color)
Returns the color of the current theme for a color of the default one.
A color made from one of the default theme with another alpha, such as a highlight faded in, gets the color of the current theme with its own alpha. A color that isn't one of the default theme is returned as it is. With the default theme, nothing is looked up.
static float Jazz2:: UI:: Windows:: Theme:: GetTextScale(float scale)
Returns the size text is drawn at for a scale of the interface.
It's TextScale times the scale, unless a whole multiple of the size of the font is close to that — the pixel font is crisp only at a whole multiple, so it's taken then. It's never more than a few percent larger than asked, larger text wouldn't fit the rows anymore, but it can be up to 15 % smaller. The readable font is drawn for the same scale, so the layout doesn't change with the font.
Variable documentation
static bool Jazz2:: UI:: Windows:: Theme:: ReadableFont
Whether text is in the readable font instead of the pixel font of the game, set by Apply().
See ReadableFont. It's measured as the pixel font is, so the layout stays.
static std:: uint32_t Jazz2:: UI:: Windows:: Theme:: FontVersion
Changes whenever text is measured in another font, set by Apply().
Both fonts have the same height of text, so a width of a text kept for later is measured again when this changes.