Player12
An open source football management simulator
Loading...
Searching...
No Matches
theme.h File Reference
#include <imgui.h>
#include <cstdint>
#include <optional>
#include "global/types.h"

Go to the source code of this file.

Classes

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

Namespaces

namespace  Theme
 Design tokens shared by every management screen.
 
namespace  Theme::Space
 Spacing scale in unscaled pixels.
 

Enumerations

enum class  Theme::Text : uint8_t {
  Theme::CAPTION , Theme::SMALL , Theme::BODY , Theme::TITLE ,
  Theme::HEADING , Theme::DISPLAY
}
 Typography scale. More...
 
enum class  Theme::Preset : uint8_t {
  Theme::DARK_SLATE , Theme::MIDNIGHT_BLUE , Theme::PITCH_GREEN , Theme::LIGHT ,
  Theme::HIGH_CONTRAST , Theme::TRUE_DARK , Theme::COUNT
}
 Built-in palettes. More...
 
enum class  Theme::ColorVision : uint8_t { Theme::STANDARD , Theme::RED_GREEN , Theme::BLUE_YELLOW , Theme::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 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.
 

Variables

constexpr float Theme::Space::XS = 4.0f
 
constexpr float Theme::Space::S = 8.0f
 
constexpr float Theme::Space::M = 12.0f
 
constexpr float Theme::Space::L = 16.0f
 
constexpr float Theme::Space::XL = 24.0f