Player12
An open source football management simulator
Loading...
Searching...
No Matches
theme.cpp File Reference
#include "gui/widgets/theme.h"
#include <algorithm>
#include <array>
#include <cmath>
#include <numbers>
#include <utility>

Namespaces

namespace  Theme
 Design tokens shared by every management screen.
 

Functions

Palette Theme::presetPalette (Preset preset, ColorVision vision, const ImVec4 &accent)
 Palette of a preset without applying it (no ImGui state touched), e.g. for previews and contrast checks.
 
const char * Theme::colorVisionKey (ColorVision vision)
 Localisation key of a colour-vision mode's name.
 
float Theme::contrastRatio (const ImVec4 &first, const ImVec4 &second)
 WCAG contrast ratio of two opaque colours (1 to 21).
 
const Palette & Theme::palette ()
 Returns the active palette (accent included).
 
const Appearance & Theme::appearance ()
 Returns the active appearance options.
 
void Theme::apply (const Appearance &options, float displayScale)
 Applies an appearance to the current ImGui style.
 
void Theme::setClub (std::optional< TeamID > teamId)
 Tells the theme which club is managed (for club accents).
 
float Theme::scale ()
 Effective UI scale (fonts and sizes).
 
bool Theme::reducedMotion ()
 True when animations should be avoided.
 
Swatch Theme::presetSwatch (Preset preset)
 Preview colours of a preset without applying it.
 
const char * Theme::presetKey (Preset preset)
 Localisation key of a preset name.
 
ImVec4 Theme::clubAccent (TeamID teamId)
 Deterministic accent colour for a club.
 
ImVec4 Theme::ratingColor (double value)
 Continuous colour scale for 0-100 ratings (red to green).
 
float Theme::textSize (Text level)
 Unscaled pixel size for a typography level.
 
ImU32 Theme::toU32 (const ImVec4 &color, float alpha=1.0f)
 Converts a colour with an optional alpha multiplier.
 
uint32_t Theme::packRgb (const ImVec4 &color)
 Packs an opaque colour as 0xRRGGBB (for settings files).
 
ImVec4 Theme::unpackRgb (uint32_t rgb)
 Unpacks 0xRRGGBB into an opaque colour.