7#include <unordered_map>
67 std::unordered_map<std::string, Style>
styles;
A fill: solid color, gradient or texture, as used for backgrounds, borders, text and icons.
Definition gui_style.h:524
StyleSheet ParseStyleSheet(std::string_view source)
Parses a theme's CSS (the subset TachyonUI supports, see docs/css.md) into a StyleSheet.
constexpr int kMaxBoxShadows
CSS box-shadow layers per state; the first is drawn on top.
Definition gui_style.h:114
Definition gui_logging.h:24
One CSS box-shadow layer, outside the border box.
Definition gui_style.h:121
A class's styles for where an element is among its parent's children, from its :first-child,...
Definition gui_style_sheet.h:57
Style first
the first of several children
Definition gui_style_sheet.h:58
Style last
the last of several children
Definition gui_style_sheet.h:59
Style only
the only child: the first-, last- and only-child rules apply
Definition gui_style_sheet.h:60
A resolved CSS custom property (:root { --name: value; }): a color, 1..4 numbers or a box-shadow.
Definition gui_style_sheet.h:30
uint8_t dimCount
number of values in dims, 0 = not numeric
Definition gui_style_sheet.h:38
ColorStyle colorStyle
the full value, which may be a gradient
Definition gui_style_sheet.h:32
bool hasColor
color / colorStyle are set
Definition gui_style_sheet.h:33
BoxShadow shadows[kMaxBoxShadows]
A box-shadow value (--shadow: 0 8px 20px rgba(0,0,0,0.35);, or none).
Definition gui_style_sheet.h:43
color4b color
the value as a solid color
Definition gui_style_sheet.h:31
uint16_t dims[4]
1..4 numeric values (--border-first: 2px 2px 2px 2px;), for shorthands such as border-width and borde...
Definition gui_style_sheet.h:37
bool hasShadow
shadows is set (all-empty for none)
Definition gui_style_sheet.h:44
float number
== dims[0] when dimCount >= 1
Definition gui_style_sheet.h:39
bool hasNumber
dimCount >= 1
Definition gui_style_sheet.h:40
One @font-face rule. Faces sharing a family name form one family.
Definition gui_style_sheet.h:49
std::string src
as written; relative paths are relative to the stylesheet
Definition gui_style_sheet.h:51
std::string family
font-family name
Definition gui_style_sheet.h:50
A problem found while parsing a style sheet; the parser skips the bad part and goes on.
Definition gui_style_sheet.h:21
std::string message
what is wrong
Definition gui_style_sheet.h:22
int column
column of the problem on that line
Definition gui_style_sheet.h:24
int line
1-based line of the problem in the parsed source
Definition gui_style_sheet.h:23
A parsed style sheet: named styles, custom properties and font faces.
Definition gui_style_sheet.h:66
Style baseStyle
what * rules set; styles start from it
Definition gui_style_sheet.h:73
std::unordered_map< std::string, Style > styles
keyed by class name, without the '.
Definition gui_style_sheet.h:67
std::unordered_map< std::string, CustomProperty > customProperties
keyed by name including the leading "--"
Definition gui_style_sheet.h:71
const Style * GetStyle(std::string_view name) const
The style of a class name (without the '.'); nullptr when not defined.
bool HasErrors() const
True when parsing reported any error.
Definition gui_style_sheet.h:77
std::vector< ParseError > errors
in the order found
Definition gui_style_sheet.h:74
std::vector< FontFace > fontFaces
in source order
Definition gui_style_sheet.h:72
const CustomProperty * GetCustomProperty(std::string_view name) const
A custom property by name (with the leading "--"); nullptr when not defined.
std::unordered_map< std::string, ChildStyles > childStyles
The classes with :first-child / :last-child / :only-child rules; register them with StyleManager::Reg...
Definition gui_style_sheet.h:70
A complete style, as parsed from CSS or built in code: layout properties plus the visual properties o...
Definition gui_style.h:687
Definition gui_base_types.h:384