vstyle.h Header

#include <vstyle.h>

Types

struct ResolvedStyle Fully-resolved styling for a single box/text node. Colors are hex strings ("#rrggbb" / "#aarrggbb"). Gradients are stored as comma-joined stops ("0:#3a3c42,1:#42454d") with the matching *IsGradient flag set.

Functions

ResolvedStyle resolve_style(Layers::LLayer * style, const std::vector<std::string> & states = {})
void apply_mobile_scale(ResolvedStyle & rs, Layers::LLayer * style, const std::vector<std::string> & states, bool is_icon, double icon_scale, double font_scale, double metric_scale)

Function Documentation

ResolvedStyle resolve_style(Layers::LLayer * style, const std::vector<std::string> & states = {})

Resolve a style's values for the given state combo. Missing attributes resolve to defaults rather than failing; a null style yields defaults.

void apply_mobile_scale(ResolvedStyle & rs, Layers::LLayer * style, const std::vector<std::string> & states, bool is_icon, double icon_scale, double font_scale, double metric_scale)

Mobile auto-scale. On a phone-class platform (the active combo contains "Mobile") the whole interface generally needs to be larger than its desktop/web pixel sizes. Rather than hand-author a "@Mobile" value on every attribute, this multiplies the already-resolved numbers by one of three factors:

  • icon_scale — an icon node's Size.Width/Height,
  • font_scale — Font.Size on any text-bearing node,
  • metric_scale— every other pixel length: a non-icon's Size.Width/Height, Layout.Spacing, Margins., Padding., Corner Radii.*, and Border.Thickness. UNLESS the author supplied an explicit "@Mobile" (or "@Mobile&..."-qualified) override for that attribute, which then wins verbatim so per-attribute exceptions still work. The factors are separate because the three groups want different bumps at the same screen size (icons largest, text gentler, spacing proportional to the content). Unitless/ratio values are intentionally NOT scaled: Layout.Grow (a flex ratio), Transform.Offset Y (a fraction of the node's own height), and Font.Weight. A no-op when not on mobile, when the relevant factor is 1, or when the attribute is unset. is_icon selects the icon vs metric factor for Size.Width/Height; style/states are the same style + full combo passed to resolve_style (needed to detect a Mobile override).
Appearance
Theme
—