Player12
An open source football management simulator
Loading...
Searching...
No Matches
Theme Namespace Reference

Design tokens shared by every management screen. More...

Namespaces

namespace  Space
 Spacing scale in unscaled pixels.
 

Classes

struct  Appearance
 User-selected appearance options. More...
 
struct  Palette
 Semantic colours used by widgets. More...
 
class  ScopedText
 Pushes a typography level for the lifetime of the object. More...
 
struct  Swatch
 Representative colours of a preset, for previews. More...
 

Enumerations

enum class  Text : uint8_t {
  CAPTION , SMALL , BODY , TITLE ,
  HEADING , DISPLAY
}
 Typography scale. More...
 
enum class  Preset : uint8_t {
  DARK_SLATE , MIDNIGHT_BLUE , PITCH_GREEN , LIGHT ,
  HIGH_CONTRAST , TRUE_DARK , COUNT
}
 Built-in palettes. More...
 
enum class  ColorVision : uint8_t { STANDARD , RED_GREEN , BLUE_YELLOW , COUNT }
 Hues of the status colours. Good and bad are never told apart by red against green alone in the safe modes. More...
 

Functions

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

Detailed Description

Design tokens shared by every management screen.

A theme is a preset palette plus one accent colour (the managed club's or a custom one). Typography uses the one bundled TTF at several sizes through ImGui's dynamic font atlas, and a small spacing scale keeps rhythm consistent between screens. Everything is re-applied live when the user changes appearance settings or the window moves to another display.

Enumeration Type Documentation

◆ ColorVision

enum class Theme::ColorVision : uint8_t
strong

Hues of the status colours. Good and bad are never told apart by red against green alone in the safe modes.

Enumerator
STANDARD 

Green good, red bad.

RED_GREEN 

Blue good, orange bad (protanopia, deuteranopia).

BLUE_YELLOW 

Teal good, magenta bad (tritanopia).

COUNT 

◆ Preset

enum class Theme::Preset : uint8_t
strong

Built-in palettes.

Enumerator
DARK_SLATE 
MIDNIGHT_BLUE 
PITCH_GREEN 
LIGHT 
HIGH_CONTRAST 
TRUE_DARK 

Appended so saved preset indices stay valid.

COUNT 

◆ Text

enum class Theme::Text : uint8_t
strong

Typography scale.

Enumerator
CAPTION 

Column labels, card captions, badges.

SMALL 

Secondary table text and helper copy.

BODY 

Default text.

TITLE 

Card and section titles.

HEADING 

Page headings.

DISPLAY 

Large figures on stat tiles.

Function Documentation

◆ appearance()

const Appearance & Theme::appearance ( )

Returns the active appearance options.

◆ apply()

void Theme::apply ( const Appearance &  options,
float  displayScale 
)

Applies an appearance to the current ImGui style.

Parameters
optionsPreset, accent, scale and density choices.
displayScaleDisplay content scale used when ui_scale is automatic.

◆ clubAccent()

ImVec4 Theme::clubAccent ( TeamID  teamId)

Deterministic accent colour for a club.

◆ colorVisionKey()

const char * Theme::colorVisionKey ( ColorVision  vision)

Localisation key of a colour-vision mode's name.

◆ contrastRatio()

float Theme::contrastRatio ( const ImVec4 &  first,
const ImVec4 &  second 
)

WCAG contrast ratio of two opaque colours (1 to 21).

◆ packRgb()

uint32_t Theme::packRgb ( const ImVec4 &  color)

Packs an opaque colour as 0xRRGGBB (for settings files).

◆ palette()

const Palette & Theme::palette ( )

Returns the active palette (accent included).

◆ presetKey()

const char * Theme::presetKey ( Preset  preset)

Localisation key of a preset name.

◆ presetPalette()

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.

◆ presetSwatch()

Swatch Theme::presetSwatch ( Preset  preset)

Preview colours of a preset without applying it.

◆ ratingColor()

ImVec4 Theme::ratingColor ( double  value)

Continuous colour scale for 0-100 ratings (red to green).

◆ reducedMotion()

bool Theme::reducedMotion ( )

True when animations should be avoided.

◆ scale()

float Theme::scale ( )

Effective UI scale (fonts and sizes).

◆ setClub()

void Theme::setClub ( std::optional< TeamID >  teamId)

Tells the theme which club is managed (for club accents).

◆ textSize()

float Theme::textSize ( Text  level)

Unscaled pixel size for a typography level.

◆ toU32()

ImU32 Theme::toU32 ( const ImVec4 &  color,
float  alpha 
)

Converts a colour with an optional alpha multiplier.

◆ unpackRgb()

ImVec4 Theme::unpackRgb ( uint32_t  rgb)

Unpacks 0xRRGGBB into an opaque colour.