Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::view::Theme Struct Reference

#include <theme.hpp>

Public Member Functions

std::optional< Color > color (const std::string &name) const
std::optional< float > dimension (const std::string &name) const
std::optional< std::string > string_token (const std::string &name) const
void apply_overrides (const Theme &overrides)
std::string to_json () const
bool save_to_file (const std::string &path) const
 Save theme to a JSON file. Returns true on success.
std::vector< std::string > missing_tokens () const
 Check if this theme has all required tokens. Returns list of missing token names.
bool is_complete () const
 Returns true if this theme defines all required tokens.
void fill_from (const Theme &base)
 Merge with a base theme to fill in any missing tokens.

Static Public Member Functions

static int schema_version_of (const std::string &json)
static std::string migrate_json (const std::string &json, int from_version)
static Theme from_json (const std::string &json)
static Theme dark ()
static Theme light ()
static Theme pro_audio ()
static Theme load_from_file (const std::string &path)
 Load theme from a JSON file. Returns empty Theme on failure.
static const std::vector< std::string > & required_color_tokens ()
 List of required color tokens that every complete theme must define.

Public Attributes

std::unordered_map< std::string, Color > colors
std::unordered_map< std::string, float > dimensions
std::unordered_map< std::string, std::string > strings

Static Public Attributes

static constexpr int kSchemaVersion = 1

Member Function Documentation

◆ apply_overrides()

void pulp::view::Theme::apply_overrides ( const Theme & overrides)

◆ color()

std::optional< Color > pulp::view::Theme::color ( const std::string & name) const

◆ dark()

Theme pulp::view::Theme::dark ( )
static

◆ dimension()

std::optional< float > pulp::view::Theme::dimension ( const std::string & name) const

◆ fill_from()

void pulp::view::Theme::fill_from ( const Theme & base)

Merge with a base theme to fill in any missing tokens.

Missing tokens in *this are filled from base. Existing tokens are kept.

◆ from_json()

Theme pulp::view::Theme::from_json ( const std::string & json)
static

◆ is_complete()

bool pulp::view::Theme::is_complete ( ) const

Returns true if this theme defines all required tokens.

◆ light()

Theme pulp::view::Theme::light ( )
static

◆ load_from_file()

Theme pulp::view::Theme::load_from_file ( const std::string & path)
static

Load theme from a JSON file. Returns empty Theme on failure.

◆ migrate_json()

std::string pulp::view::Theme::migrate_json ( const std::string & json,
int from_version )
static

◆ missing_tokens()

std::vector< std::string > pulp::view::Theme::missing_tokens ( ) const

Check if this theme has all required tokens. Returns list of missing token names.

◆ pro_audio()

Theme pulp::view::Theme::pro_audio ( )
static

◆ required_color_tokens()

const std::vector< std::string > & pulp::view::Theme::required_color_tokens ( )
static

List of required color tokens that every complete theme must define.

◆ save_to_file()

bool pulp::view::Theme::save_to_file ( const std::string & path) const

Save theme to a JSON file. Returns true on success.

◆ schema_version_of()

int pulp::view::Theme::schema_version_of ( const std::string & json)
static

◆ string_token()

std::optional< std::string > pulp::view::Theme::string_token ( const std::string & name) const

◆ to_json()

std::string pulp::view::Theme::to_json ( ) const

Member Data Documentation

◆ colors

std::unordered_map<std::string, Color> pulp::view::Theme::colors

◆ dimensions

std::unordered_map<std::string, float> pulp::view::Theme::dimensions

◆ kSchemaVersion

int pulp::view::Theme::kSchemaVersion = 1
staticconstexpr

◆ strings

std::unordered_map<std::string, std::string> pulp::view::Theme::strings

The documentation for this struct was generated from the following file:
  • /home/runner/work/pulp/pulp/core/view/include/pulp/view/theme.hpp