morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
theme.hpp File Reference

Theme tokens (ui-theme/1, spec 6 §6): DTCG 2025.10 token files read and checked, layered into a variant, their aliases resolved, and the closed ui-theme/1 set filled from them with its defaults. No toolkit: the Qt Quick renderer applies the result (qt_quick::applyTheme). More...

#include <algorithm>
#include <array>
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <expected>
#include <functional>
#include <initializer_list>
#include <map>
#include <optional>
#include <string>
#include <string_view>
#include <utility>
#include <variant>
#include <vector>
#include "bundle.hpp"
#include "value.hpp"

Go to the source code of this file.

Classes

struct  morph::ui::Token
 One token: its DTCG type and its value, which may hold aliases until the set is resolved. More...
struct  morph::ui::Rgba
 A colour, 8 bits per channel. More...
struct  morph::ui::ThemeIndex
 The index of a theme: which token files make up each variant. More...
class  morph::ui::detail::AliasResolver
 Resolves tokens' aliases, depth first, each token once. More...
struct  morph::ui::ThemeShadowSpec
 A shadow token's default, in the form a constexpr table can hold. More...
struct  morph::ui::ThemeTokenSpec
 One token of the closed ui-theme/1 set: its path, kind and the MorphUi default. More...
struct  morph::ui::ThemeShadow
 A shadow of the set, resolved. More...
struct  morph::ui::ThemeValues
 The ui-theme/1 set's values for one resolved theme. More...

Typedefs

using morph::ui::TokenSet = std::map<std::string, Token, std::less<>>
 Tokens by their dotted path, such as color.accent.
using morph::ui::TokenFileLookup = std::function<TokenSet const*(std::string_view fileId)>
 Finds a token file of the bundle by id.

Enumerations

enum class  morph::ui::ThemeTokenKind : std::uint8_t {
  Color , Number , Dimension , Shadow ,
  FontFamily
}
 What a ui-theme/1 token is read as. More...

Functions

bool morph::ui::isIconName (std::string_view name)
 Whether name is an icon name: [a-z][a-z0-9.-]{0,63}.
std::string_view morph::ui::iconGlyph (std::string_view name)
 The glyph a text renderer draws for a framework icon name.
std::optional< double > morph::ui::detail::numberOf (Json const &json)
 A number of a JSON value.
Json const * morph::ui::detail::memberOf (Json::object_t const &object, std::string_view name)
 A member of a JSON object.
std::optional< double > morph::ui::detail::pixelsOf (Json const &json)
 A DTCG dimension value in px.
std::optional< Rgba > morph::ui::detail::hexColor (std::string_view text)
 Reads #rgb, #rrggbb or #rrggbbaa.
std::optional< std::uint8_t > morph::ui::detail::channelOf (double const value)
 A channel from 0 to 1, as 8 bits.
std::optional< std::string_view > morph::ui::detail::aliasOf (std::string_view text)
 Whether a string is an alias, {a.b}.
bool morph::ui::detail::holdsAlias (Json const &json)
 Whether a value holds an alias anywhere.
std::optional< std::string > morph::ui::detail::checkTokenValue (std::string_view type, Json const &value)
 Whether a resolved value has its type's shape.
std::optional< Rgba > morph::ui::colorOf (Json const &json)
 Reads a colour value: #rgb, #rrggbb, #rrggbbaa, or the DTCG 2025.10 object, by its hex or by its srgb components (0 to 1) and alpha.
std::optional< std::string > morph::ui::detail::checkMeasure (std::string_view type, Json const &value)
 Checks a dimension or a duration: an object of a number value and a known unit.
std::optional< std::string > morph::ui::detail::checkFontFamily (Json const &value)
 Checks a fontFamily: a name, or a non-empty list of names.
std::optional< std::string > morph::ui::detail::checkFontWeight (Json const &value)
 Checks a fontWeight: 1 to 1000, or a DTCG weight name.
std::optional< std::string > morph::ui::detail::checkShadow (Json const &value)
 Checks a shadow: an object of a color and the dimensions offsetX, offsetY, blur and spread, or a non-empty list of them.
std::string morph::ui::detail::joined (std::initializer_list< std::string_view > parts)
 Joins text, for a refusal built inside a loop.
std::expected< std::string, std::string > morph::ui::detail::declaredType (Json::object_t const &object, std::string_view where, std::string const &inherited)
 The $type an object declares, or the one it inherits.
std::optional< std::string > morph::ui::detail::readToken (std::string const &path, Json::object_t const &object, Json const &value, std::string const &type, TokenSet &out)
 Reads one token into out.
std::optional< std::string > morph::ui::detail::checkMemberName (std::string const &prefix, std::string const &name)
 Refuses a member name a token file may not have.
std::optional< std::string > morph::ui::detail::readGroup (Json::object_t const &group, std::string const &prefix, std::string const &inherited, TokenSet &out)
 Reads the tokens of one group into out.
std::optional< std::string > morph::ui::detail::readThemeMap (Json::object_t const &index, std::string_view key, std::map< std::string, std::string, std::less<> > &out)
 Reads a map of name to file id from a theme index.
std::optional< std::string > morph::ui::detail::readIcons (Json::object_t const &index, std::map< std::string, std::string, std::less<> > &out)
 Reads a theme index's icons: an object of icon name (isIconName) to icon file id, at most kMaxThemeIcons names.
bool morph::ui::isThemeIndex (std::string_view text)
 Whether a theme file is a theme index rather than a token file: its top level has a string vocab.
std::expected< TokenSet, std::string > morph::ui::parseTokens (std::string_view text)
 Parses a DTCG 2025.10 token file.
std::expected< TokenSet, std::string > morph::ui::resolveTokens (std::vector< TokenSet const * > const &layers)
 Layers token files, later ones winning per path, and resolves every alias.
std::expected< ThemeIndex, std::string > morph::ui::parseThemeIndex (std::string_view text)
 Parses a theme index: {"vocab": "ui-theme/1", "base": id, "dark": id, …, "density": {...}, "surfaces": {...}, "icons": {...}}.
std::expected< TokenSet, std::string > morph::ui::resolveTheme (ThemeIndex const &index, TokenFileLookup const &files, std::string_view variant, std::string_view density, std::string_view surface)
 Resolves one combination of a theme: base, then the variant, the density and the surface, each optional.
std::optional< std::string > morph::ui::checkTheme (ThemeIndex const &index, TokenFileLookup const &files)
 Checks that every combination of a theme resolves: each variant (or none), density (or none) and surface (or none) over base.
std::optional< ThemeShadow > morph::ui::detail::shadowOf (Json const &json)
 A checked shadow value as a ThemeShadow; of a list of layers, the first.
std::vector< std::string > morph::ui::detail::familiesOf (Json const &json)
 A checked fontFamily value as its names, in order: one name, or a list of them.
Token const * morph::ui::detail::tokenAt (TokenSet const &resolved, std::string_view path)
 A resolved theme's token at a path.
std::vector< std::string > morph::ui::detail::familyValue (ThemeTokenSpec const &spec, Token const *found)
 A font.family token's value: the theme's names when it has the token as a fontFamily, else the default.
ThemeValues morph::ui::themeValues (TokenSet const &resolved={})
 Fills the closed ui-theme/1 set from a resolved theme.

Variables

constexpr std::string_view morph::ui::kThemeVocabulary = "ui-theme/1"
 The vocabulary of a theme index.
constexpr std::size_t morph::ui::kMaxThemeTokens = 16384
 The most tokens one token file may hold.
constexpr std::size_t morph::ui::kMaxThemeVariants = 16
 The most variants, densities or surfaces a theme index may list, each.
constexpr std::size_t morph::ui::kMaxThemeIcons = 256
 The most names a theme index's icon set may hold.
constexpr std::array< std::string_view, 11 > morph::ui::kFrameworkIcons
 The icon names the built-in components draw: an empty state without an icon of its own, a banner's tone, a chevron that opens and closes, a close button, and a date input's calendar. A bundle's icon set replaces any of them by name.
constexpr std::size_t morph::ui::kMaxAliasChain = 64
 The longest chain of aliases a token may resolve through.
constexpr double morph::ui::detail::kPixelsPerRem = 16.0
 How many px a rem is: the default root font size, which the renderers do not change.
constexpr std::array< std::string_view, 13 > morph::ui::detail::kKnownTokenTypes
 The types the client checks; a token of another $type the client still knows is accepted unchecked.
constexpr std::array< std::string_view, 18 > morph::ui::detail::kFontWeights
 The named font weights of DTCG.
constexpr std::array< ThemeTokenSpec, 40 > morph::ui::kThemeTokens
 The closed ui-theme/1 token set, with the MorphUi defaults: the colour roles, the opacity and the spacing scale (space.0 to space.5, one per spacing step) the built-in components read, and the semantic sets (ok, warn, err, info with bg, border and dot).

Detailed Description

Theme tokens (ui-theme/1, spec 6 §6): DTCG 2025.10 token files read and checked, layered into a variant, their aliases resolved, and the closed ui-theme/1 set filled from them with its defaults. No toolkit: the Qt Quick renderer applies the result (qt_quick::applyTheme).

Specified in docs/spec/ui/theme.md.

Definition in file theme.hpp.

Typedef Documentation

◆ TokenSet

using morph::ui::TokenSet = std::map<std::string, Token, std::less<>>

Tokens by their dotted path, such as color.accent.

Definition at line 99 of file theme.hpp.

◆ TokenFileLookup

using morph::ui::TokenFileLookup = std::function<TokenSet const*(std::string_view fileId)>

Finds a token file of the bundle by id.

Definition at line 852 of file theme.hpp.

Enumeration Type Documentation

◆ ThemeTokenKind

enum class morph::ui::ThemeTokenKind : std::uint8_t
strong

What a ui-theme/1 token is read as.

Enumerator
Color 

A color token.

Number 

A number token.

Dimension 

A dimension token, read in px (a rem is 16 px).

Shadow 

A shadow token: a colour and four px lengths; of a list of layers, the first.

FontFamily 

A fontFamily token: a family name, or a list of them in order of preference.

Definition at line 948 of file theme.hpp.

Function Documentation

◆ isIconName()

bool morph::ui::isIconName ( std::string_view name)
inlinenodiscard

Whether name is an icon name: [a-z][a-z0-9.-]{0,63}.

Parameters
nameThe name.
Returns
It.

Definition at line 54 of file theme.hpp.

◆ iconGlyph()

std::string_view morph::ui::iconGlyph ( std::string_view name)
inlinenodiscard

The glyph a text renderer draws for a framework icon name.

Parameters
nameThe icon name.
Returns
The glyph, or empty for a name that has none (empty, which a text renderer draws as nothing).

Definition at line 66 of file theme.hpp.

◆ numberOf()

std::optional< double > morph::ui::detail::numberOf ( Json const & json)
inlinenodiscard

A number of a JSON value.

Parameters
jsonThe value.
Returns
It, or nothing when it is not a number.

Definition at line 154 of file theme.hpp.

◆ memberOf()

Json const * morph::ui::detail::memberOf ( Json::object_t const & object,
std::string_view name )
inlinenodiscard

A member of a JSON object.

Parameters
objectThe object.
nameThe member.
Returns
It, or null.

Definition at line 171 of file theme.hpp.

◆ pixelsOf()

std::optional< double > morph::ui::detail::pixelsOf ( Json const & json)
inlinenodiscard

A DTCG dimension value in px.

Parameters
jsonThe value: an object of a number value and the unit px or rem.
Returns
Its length in px, or nothing when it is not a dimension.

Definition at line 182 of file theme.hpp.

◆ hexColor()

std::optional< Rgba > morph::ui::detail::hexColor ( std::string_view text)
inlinenodiscard

Reads #rgb, #rrggbb or #rrggbbaa.

Parameters
textThe text.
Returns
The colour, or nothing.

Definition at line 206 of file theme.hpp.

◆ channelOf()

std::optional< std::uint8_t > morph::ui::detail::channelOf ( double const value)
inlinenodiscard

A channel from 0 to 1, as 8 bits.

Parameters
valueThe channel.
Returns
It, or nothing outside 0 to 1.

Definition at line 244 of file theme.hpp.

◆ aliasOf()

std::optional< std::string_view > morph::ui::detail::aliasOf ( std::string_view text)
inlinenodiscard

Whether a string is an alias, {a.b}.

Parameters
textThe text.
Returns
The path it names, or nothing.

Definition at line 254 of file theme.hpp.

◆ holdsAlias()

bool morph::ui::detail::holdsAlias ( Json const & json)
inlinenodiscard

Whether a value holds an alias anywhere.

Parameters
jsonThe value.
Returns
Whether it does.

Definition at line 265 of file theme.hpp.

◆ checkTokenValue()

std::optional< std::string > morph::ui::detail::checkTokenValue ( std::string_view type,
Json const & value )
inlinenodiscard

Whether a resolved value has its type's shape.

Parameters
typeThe $type.
valueThe value, with no alias left.
Returns
Why it does not, or nothing.

Definition at line 433 of file theme.hpp.

◆ colorOf()

std::optional< Rgba > morph::ui::colorOf ( Json const & json)
inlinenodiscard

Reads a colour value: #rgb, #rrggbb, #rrggbbaa, or the DTCG 2025.10 object, by its hex or by its srgb components (0 to 1) and alpha.

Parameters
jsonThe value.
Returns
The colour, or nothing when it is none of those.

Definition at line 310 of file theme.hpp.

◆ checkMeasure()

std::optional< std::string > morph::ui::detail::checkMeasure ( std::string_view type,
Json const & value )
inlinenodiscard

Checks a dimension or a duration: an object of a number value and a known unit.

Parameters
typedimension or duration.
valueThe value.
Returns
Why it is not one, or nothing.

Definition at line 359 of file theme.hpp.

◆ checkFontFamily()

std::optional< std::string > morph::ui::detail::checkFontFamily ( Json const & value)
inlinenodiscard

Checks a fontFamily: a name, or a non-empty list of names.

Parameters
valueThe value.
Returns
Why it is not one, or nothing.

Definition at line 378 of file theme.hpp.

◆ checkFontWeight()

std::optional< std::string > morph::ui::detail::checkFontWeight ( Json const & value)
inlinenodiscard

Checks a fontWeight: 1 to 1000, or a DTCG weight name.

Parameters
valueThe value.
Returns
Why it is not one, or nothing.

Definition at line 392 of file theme.hpp.

◆ checkShadow()

std::optional< std::string > morph::ui::detail::checkShadow ( Json const & value)
inlinenodiscard

Checks a shadow: an object of a color and the dimensions offsetX, offsetY, blur and spread, or a non-empty list of them.

Parameters
valueThe value.
Returns
Why it is not one, or nothing.

Definition at line 407 of file theme.hpp.

◆ joined()

std::string morph::ui::detail::joined ( std::initializer_list< std::string_view > parts)
inlinenodiscard

Joins text, for a refusal built inside a loop.

Parameters
partsThe pieces.
Returns
Them, in order.

Definition at line 458 of file theme.hpp.

◆ declaredType()

std::expected< std::string, std::string > morph::ui::detail::declaredType ( Json::object_t const & object,
std::string_view where,
std::string const & inherited )
inlinenodiscard

The $type an object declares, or the one it inherits.

Parameters
objectThe group's or token's members.
whereIts path with a trailing ., for the refusal.
inheritedThe nearest enclosing $type.
Returns
The type, or why the declaration is refused.

Definition at line 472 of file theme.hpp.

◆ readToken()

std::optional< std::string > morph::ui::detail::readToken ( std::string const & path,
Json::object_t const & object,
Json const & value,
std::string const & type,
TokenSet & out )
inlinenodiscard

Reads one token into out.

Parameters
pathThe token's path.
objectThe token's members.
valueIts $value.
typeThe type it inherits.
outWhere it goes.
Returns
Why the file is refused, or nothing.

Definition at line 493 of file theme.hpp.

◆ checkMemberName()

std::optional< std::string > morph::ui::detail::checkMemberName ( std::string const & prefix,
std::string const & name )
inlinenodiscard

Refuses a member name a token file may not have.

Parameters
prefixThe group's path, with a trailing ..
nameThe member's name.
Returns
Why it is refused, or nothing.

Definition at line 523 of file theme.hpp.

◆ readGroup()

std::optional< std::string > morph::ui::detail::readGroup ( Json::object_t const & group,
std::string const & prefix,
std::string const & inherited,
TokenSet & out )
inlinenodiscard

Reads the tokens of one group into out.

Parameters
groupThe group's members.
prefixThe group's path, with a trailing .; empty at the top.
inheritedThe nearest enclosing $type.
outWhere the tokens go.
Returns
Why the file is refused, or nothing.

Definition at line 541 of file theme.hpp.

◆ readThemeMap()

std::optional< std::string > morph::ui::detail::readThemeMap ( Json::object_t const & index,
std::string_view key,
std::map< std::string, std::string, std::less<> > & out )
inlinenodiscard

Reads a map of name to file id from a theme index.

Parameters
indexThe index's members.
keydensity or surfaces.
outWhere the entries go.
Returns
Why the index is refused, or nothing.

Definition at line 683 of file theme.hpp.

◆ readIcons()

std::optional< std::string > morph::ui::detail::readIcons ( Json::object_t const & index,
std::map< std::string, std::string, std::less<> > & out )
inlinenodiscard

Reads a theme index's icons: an object of icon name (isIconName) to icon file id, at most kMaxThemeIcons names.

Parameters
indexThe index.
outWhere the set is read into.
Returns
Why it is refused, or nothing; nothing for an index without icons.

Definition at line 708 of file theme.hpp.

◆ isThemeIndex()

bool morph::ui::isThemeIndex ( std::string_view text)
inlinenodiscard

Whether a theme file is a theme index rather than a token file: its top level has a string vocab.

Parameters
textThe file.
Returns
Whether it is an index; text that is not a JSON object is not.

Definition at line 739 of file theme.hpp.

◆ parseTokens()

std::expected< TokenSet, std::string > morph::ui::parseTokens ( std::string_view text)
inlinenodiscard

Parses a DTCG 2025.10 token file.

Groups nest; a token is an object with $value, and its $type is its own or the nearest group's. Refused: text that is not a JSON object or nests deeper than kMaxJsonDepth, a must-understand (!) name, a name with ., { or }, a member that is not an object, a token with no type that is not a plain alias, a value that does not have its checked type's shape, $extends, and more than kMaxThemeTokens tokens. A token of a $type the client does not know is dropped.

Parameters
textThe file.
Returns
The tokens by path, aliases unresolved, or why the file is refused.

Definition at line 758 of file theme.hpp.

◆ resolveTokens()

std::expected< TokenSet, std::string > morph::ui::resolveTokens ( std::vector< TokenSet const * > const & layers)
inlinenodiscard

Layers token files, later ones winning per path, and resolves every alias.

Refused: an alias cycle, an alias to a token no layer has, a chain of more than kMaxAliasChain aliases, an alias whose declared type differs from its target's, and a resolved value that does not have its type's shape.

Parameters
layersThe files, base first.
Returns
The resolved tokens, or why the combination is refused.

Definition at line 780 of file theme.hpp.

◆ parseThemeIndex()

std::expected< ThemeIndex, std::string > morph::ui::parseThemeIndex ( std::string_view text)
inlinenodiscard

Parses a theme index: {"vocab": "ui-theme/1", "base": id, "dark": id, …, "density": {...}, "surfaces": {...}, "icons": {...}}.

Refused: not a JSON object, a vocab other than ui-theme/1, no base, a must-understand (!) key, a variant that is not a file id, a density or surfaces that is not a map of name to file id, and more than kMaxThemeVariants variants, densities or surfaces, and an icons that is not an object of icon name (isIconName) to file id or holds more than kMaxThemeIcons names.

Parameters
textThe index.
Returns
The index, or why it is refused.

Definition at line 799 of file theme.hpp.

◆ resolveTheme()

std::expected< TokenSet, std::string > morph::ui::resolveTheme ( ThemeIndex const & index,
TokenFileLookup const & files,
std::string_view variant,
std::string_view density,
std::string_view surface )
inlinenodiscard

Resolves one combination of a theme: base, then the variant, the density and the surface, each optional.

Parameters
indexThe theme index.
filesThe bundle's token files.
variantA variant name, or empty for base alone.
densityA density name, or empty for none.
surfaceA surface name, or empty for none.
Returns
The resolved tokens, or why they are refused: a name the index does not list, a file the bundle lacks, or resolveTokens' refusals.

Definition at line 863 of file theme.hpp.

◆ checkTheme()

std::optional< std::string > morph::ui::checkTheme ( ThemeIndex const & index,
TokenFileLookup const & files )
inlinenodiscard

Checks that every combination of a theme resolves: each variant (or none), density (or none) and surface (or none) over base.

Parameters
indexThe theme index.
filesThe bundle's token files.
Returns
Why the theme is refused, naming the combination, or nothing.

Definition at line 910 of file theme.hpp.

◆ shadowOf()

std::optional< ThemeShadow > morph::ui::detail::shadowOf ( Json const & json)
inlinenodiscard

A checked shadow value as a ThemeShadow; of a list of layers, the first.

Parameters
jsonThe value, checked by checkShadow.
Returns
It, or nothing when it is not a shadow.

Definition at line 1070 of file theme.hpp.

◆ familiesOf()

std::vector< std::string > morph::ui::detail::familiesOf ( Json const & json)
inlinenodiscard

A checked fontFamily value as its names, in order: one name, or a list of them.

Parameters
jsonThe value, checked by checkFontFamily.
Returns
The names; empty when it is neither.

Definition at line 1101 of file theme.hpp.

◆ tokenAt()

Token const * morph::ui::detail::tokenAt ( TokenSet const & resolved,
std::string_view path )
inlinenodiscard

A resolved theme's token at a path.

Parameters
resolvedThe resolved tokens.
pathThe token's path.
Returns
It, or null when the theme does not have it.

Definition at line 1123 of file theme.hpp.

◆ familyValue()

std::vector< std::string > morph::ui::detail::familyValue ( ThemeTokenSpec const & spec,
Token const * found )
inlinenodiscard

A font.family token's value: the theme's names when it has the token as a fontFamily, else the default.

Parameters
specThe token of the set.
foundThe theme's token at that path, or null.
Returns
The names, in order; empty for none.

Definition at line 1132 of file theme.hpp.

◆ themeValues()

ThemeValues morph::ui::themeValues ( TokenSet const & resolved = {})
inlinenodiscard

Fills the closed ui-theme/1 set from a resolved theme.

A path of the set takes the theme's value when the theme has it with the set's type, and its default otherwise; a token outside the set is ignored.

Parameters
resolvedThe resolved tokens; empty gives every default.
Returns
Every path of the set with its value.

Definition at line 1151 of file theme.hpp.

Variable Documentation

◆ kThemeVocabulary

std::string_view morph::ui::kThemeVocabulary = "ui-theme/1"
inlineconstexpr

The vocabulary of a theme index.

Definition at line 33 of file theme.hpp.

◆ kMaxThemeTokens

std::size_t morph::ui::kMaxThemeTokens = 16384
inlineconstexpr

The most tokens one token file may hold.

Definition at line 36 of file theme.hpp.

◆ kMaxThemeVariants

std::size_t morph::ui::kMaxThemeVariants = 16
inlineconstexpr

The most variants, densities or surfaces a theme index may list, each.

Definition at line 39 of file theme.hpp.

◆ kMaxThemeIcons

std::size_t morph::ui::kMaxThemeIcons = 256
inlineconstexpr

The most names a theme index's icon set may hold.

Definition at line 42 of file theme.hpp.

◆ kFrameworkIcons

std::array<std::string_view, 11> morph::ui::kFrameworkIcons
inlineconstexpr
Initial value:
= {
"empty", "tone.info", "tone.ok", "tone.warn", "tone.err", "nav.back",
"nav.forward", "nav.expand", "nav.collapse", "close", "date.pick"}

The icon names the built-in components draw: an empty state without an icon of its own, a banner's tone, a chevron that opens and closes, a close button, and a date input's calendar. A bundle's icon set replaces any of them by name.

Definition at line 47 of file theme.hpp.

◆ kMaxAliasChain

std::size_t morph::ui::kMaxAliasChain = 64
inlineconstexpr

The longest chain of aliases a token may resolve through.

Definition at line 88 of file theme.hpp.

◆ kPixelsPerRem

double morph::ui::detail::kPixelsPerRem = 16.0
inlineconstexpr

How many px a rem is: the default root font size, which the renderers do not change.

Definition at line 177 of file theme.hpp.

◆ kKnownTokenTypes

std::array<std::string_view, 13> morph::ui::detail::kKnownTokenTypes
inlineconstexpr
Initial value:
= {
"color", "dimension", "number", "fontFamily", "fontWeight", "duration", "cubicBezier",
"shadow", "typography", "border", "strokeStyle", "gradient", "transition"}

The types the client checks; a token of another $type the client still knows is accepted unchecked.

Definition at line 288 of file theme.hpp.

◆ kFontWeights

std::array<std::string_view, 18> morph::ui::detail::kFontWeights
inlineconstexpr
Initial value:
= {
"thin", "hairline", "extra-light", "ultra-light", "light", "normal",
"regular", "book", "medium", "semi-bold", "demi-bold", "bold",
"extra-bold", "ultra-bold", "black", "heavy", "extra-black", "ultra-black"}

The named font weights of DTCG.

Definition at line 293 of file theme.hpp.

◆ kThemeTokens

std::array<ThemeTokenSpec, 40> morph::ui::kThemeTokens
inlineconstexpr

The closed ui-theme/1 token set, with the MorphUi defaults: the colour roles, the opacity and the spacing scale (space.0 to space.5, one per spacing step) the built-in components read, and the semantic sets (ok, warn, err, info with bg, border and dot).

Definition at line 989 of file theme.hpp.