TachyonUI 0.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
Styling

Themes, styles, colors and gradients. More...

Namespaces

namespace  tachyon::ColorConvert::detail

Classes

struct  tachyon::GradientHandle
 Handle to a reference-counted GradientManager atlas slot. More...
struct  tachyon::AtlasLocation
 Where a handle's texels are in the atlas. More...
class  tachyon::GradientManager
 The atlas that the colors of color styles are baked into: pages of 2D textures, one row per gradient, with solid and 2..4-color blocks packed into shared rows. More...
struct  tachyon::BoxEdges
 Per-side values of the box model (margin, padding, border widths). More...
struct  tachyon::BoxCorners
 Per-corner values (border radius). More...
struct  tachyon::BoxShadow
 One CSS box-shadow layer, outside the border box. More...
struct  tachyon::EdgeInset
 Per-side offsets of a positioned element (CSS: top, right, bottom, left), in pixels. More...
struct  tachyon::FlexProperties
 Flexbox properties: the container's (direction, wrap, alignment, gap) and the item's own (grow, shrink, basis). More...
struct  tachyon::GridTrack
 Size of one grid column or row (CSS: -tachyon-grid-column-track / -row-track). More...
struct  tachyon::GridAxisProperties
 A grid item's placement and track request along one axis, plus the container's gap. More...
struct  tachyon::GridProperties
 Grid container and item properties. More...
struct  tachyon::LayoutData
 Flex / grid properties and CSS sizes of a style. Sizes are in CSS px in a Style. More...
class  tachyon::ColorStyle
 A fill: solid color, gradient or texture, as used for backgrounds, borders, text and icons. More...
class  tachyon::VisualColorStyle
 GPU form of a ColorStyle, uploaded as is: the gradient is baked into an atlas slot that colorUV / gradientPage point at. More...
struct  tachyon::StyleState
 The visual properties of one element state (normal, :hover, :active, ...). More...
struct  tachyon::Style
 A complete style, as parsed from CSS or built in code: layout properties plus the visual properties of each state, in CSS px. More...
struct  tachyon::LayoutStyle
 The layout part of a registered Style, in pixels; shared by every style with the same values. More...
struct  tachyon::VisualShadow
 A BoxShadow in pixels with its color registered. No color is no shadow. More...
struct  tachyon::VisualShadowStyle
 What a state draws on the CPU only: its shadows and its opacity. More...
struct  tachyon::VisualBoxStyle
 The box part of one state of a registered Style, in pixels; uploaded to the GPU as is (32 bytes). More...
struct  tachyon::VisualTextStyle
 The text part of one state of a registered Style, in pixels. More...
struct  tachyon::ColorStop
 Color stops for gradients. More...
struct  tachyon::Gradient
 Up to kMaxStops color stops plus an angle and interpolation color space. More...
struct  tachyon::TextOverride
 Per-element text overrides for StyleManager::WithTextOverride. More...
class  tachyon::StyleManager
 Bakes serializable Styles into deduplicated runtime layout/visual styles; a StyleRef holds indices into the (possibly shared) pools. More...
struct  tachyon::StyleRef
 A registered style, as StyleManager::Register returns it: indices into the shared style pools, cheap to copy. More...
struct  tachyon::ParseError
 A problem found while parsing a style sheet; the parser skips the bad part and goes on. More...
struct  tachyon::CustomProperty
 A resolved CSS custom property (:root { --name: value; }): a color, 1..4 numbers or a box-shadow. More...
struct  tachyon::FontFace
 One @font-face rule. Faces sharing a family name form one family. More...
struct  tachyon::ChildStyles
 A class's styles for where an element is among its parent's children, from its :first-child, :last-child and :only-child rules (box properties only). More...
struct  tachyon::StyleSheet
 A parsed style sheet: named styles, custom properties and font faces. More...
struct  tachyon::LanguageTag
 A BCP 47 language tag ("ja", "zh-Hant", "ko-KR") stored inline, so text styles stay plain values. More...
class  tachyon::TextLayoutStyle
 How a text block is laid out in its box; shared by all states of a Style. More...
class  tachyon::TextDecoration
 One text decoration line (underline, overline, ...). More...
class  tachyon::TextStyle
 What text is measured and laid out from: font, metrics and decoration lines. More...
struct  tachyon::ControlStyles
 Default control styles. More...
class  tachyon::GUITheme
 The library's styles, icons and theme metrics, the defaults the controls draw with. More...

Typedefs

using tachyon::VisualBoxStyleStates = VisualBoxStyle[Style::kStateCount]
 A box style's variants, one per visual element state (Style::kStateCount).
using tachyon::VisualTextStyleStates = VisualTextStyle[Style::kStateCount]
 A text style's variants, one per visual element state (Style::kStateCount).

Enumerations

enum class  tachyon::VisualColorStyleIndex : uint16_t { tachyon::VisualColorStyleIndex::Invalid = 0 }
 Index into StyleManager's color style pool; Invalid (0) draws nothing (transparent). More...
enum class  tachyon::ElementState : uint8_t {
  tachyon::ElementState::None = 0 , tachyon::ElementState::Active = 1 << 0 , tachyon::ElementState::Hover = 1 << 1 , tachyon::ElementState::Focused = 1 << 2 ,
  tachyon::ElementState::Selected = 1 << 3 , tachyon::ElementState::Selection = 1 << 4 , tachyon::ElementState::Disabled = 1 << 5 , tachyon::ElementState::Invalid = 1 << 6 ,
  tachyon::ElementState::VisualMask = Active | Hover | Focused | Selected | Selection | Disabled
}
 Interaction state bits of an element; they pick the Style::states variant it draws with. More...
enum class  tachyon::FlexDirection : uint8_t { tachyon::FlexDirection::Row , tachyon::FlexDirection::RowReverse , tachyon::FlexDirection::Column , tachyon::FlexDirection::ColumnReverse }
 Main axis of a flex container (CSS: flex-direction). More...
enum class  tachyon::FlexWrap : uint8_t { tachyon::FlexWrap::NoWrap , tachyon::FlexWrap::Wrap , tachyon::FlexWrap::WrapReverse }
 Whether flex items wrap onto more lines (CSS: flex-wrap). More...
enum class  tachyon::AlignItems : uint8_t {
  tachyon::AlignItems::Auto , tachyon::AlignItems::FlexStart , tachyon::AlignItems::FlexEnd , tachyon::AlignItems::Center ,
  tachyon::AlignItems::Stretch
}
 Cross-axis alignment of items (CSS: align-items, align-self). More...
enum class  tachyon::JustifyContent : uint8_t {
  tachyon::JustifyContent::FlexStart , tachyon::JustifyContent::FlexEnd , tachyon::JustifyContent::Center , tachyon::JustifyContent::SpaceBetween ,
  tachyon::JustifyContent::SpaceAround , tachyon::JustifyContent::SpaceEvenly
}
 Main-axis distribution of items (CSS: justify-content; grids also justify-items). More...
enum class  tachyon::AlignContent : uint8_t {
  tachyon::AlignContent::FlexStart , tachyon::AlignContent::FlexEnd , tachyon::AlignContent::Center , tachyon::AlignContent::Stretch ,
  tachyon::AlignContent::SpaceBetween , tachyon::AlignContent::SpaceAround , tachyon::AlignContent::SpaceEvenly
}
 Distributes cross-axis space between wrap lines (align-items aligns within a line). More...
enum class  tachyon::PositionType : uint8_t {
  tachyon::PositionType::Relative , tachyon::PositionType::Anchored , tachyon::PositionType::Absolute , tachyon::PositionType::Fixed ,
  tachyon::PositionType::Centered , tachyon::PositionType::Sticky
}
 How an element is positioned; modeled on CSS position, but set in code, not CSS. More...
enum class  tachyon::Display : uint8_t { tachyon::Display::Flex , tachyon::Display::Grid , tachyon::Display::None }
 How an element lays out its children (CSS: display). More...
enum class  tachyon::Overflow : uint8_t { tachyon::Overflow::Auto , tachyon::Overflow::Hidden , tachyon::Overflow::Visible }
 What happens to content larger than the box (CSS: overflow, overflow-x, overflow-y). More...
enum class  tachyon::Visibility : uint8_t { tachyon::Visibility::Visible , tachyon::Visibility::Collapsed }
 CSS: visibility. More...
enum class  tachyon::IconSide : uint8_t {
  tachyon::IconSide::None = 0 , tachyon::IconSide::Left , tachyon::IconSide::Right , tachyon::IconSide::Top ,
  tachyon::IconSide::Bottom
}
 Where an element's icon sits relative to its text (CSS: -tachyon-icon-side). More...
enum class  tachyon::AnchorPlacement : uint8_t {
  tachyon::AnchorPlacement::None = 0 , tachyon::AnchorPlacement::OutsideLeft = (1 << 0) , tachyon::AnchorPlacement::CenterLeft = (2 << 0) , tachyon::AnchorPlacement::InsideLeft = (3 << 0) ,
  tachyon::AnchorPlacement::CenterHorz = (4 << 0) , tachyon::AnchorPlacement::InsideRight = (5 << 0) , tachyon::AnchorPlacement::CenterRight = (6 << 0) , tachyon::AnchorPlacement::OutsideRight = (7 << 0) ,
  tachyon::AnchorPlacement::HorizontalMask = (0xF << 0) , tachyon::AnchorPlacement::OutsideTop = (1 << 4) , tachyon::AnchorPlacement::CenterTop = (2 << 4) , tachyon::AnchorPlacement::InsideTop = (3 << 4) ,
  tachyon::AnchorPlacement::CenterVert = (4 << 4) , tachyon::AnchorPlacement::InsideBottom = (5 << 4) , tachyon::AnchorPlacement::CenterBottom = (6 << 4) , tachyon::AnchorPlacement::OutsideBottom = (7 << 4) ,
  tachyon::AnchorPlacement::VerticalMask = (0xF << 4) , tachyon::AnchorPlacement::CenterCenter = CenterHorz | CenterVert , tachyon::AnchorPlacement::InsideTopLeft = InsideTop | InsideLeft , tachyon::AnchorPlacement::InsideTopRight = InsideTop | InsideRight ,
  tachyon::AnchorPlacement::InsideBottomLeft = InsideBottom | InsideLeft , tachyon::AnchorPlacement::InsideBottomRight = InsideBottom | InsideRight , tachyon::AnchorPlacement::OutsideTopLeft = OutsideTop | OutsideLeft , tachyon::AnchorPlacement::OutsideTopRight = OutsideTop | OutsideRight ,
  tachyon::AnchorPlacement::OutsideBottomLeft = OutsideBottom | OutsideLeft , tachyon::AnchorPlacement::OutsideBottomRight = OutsideBottom | OutsideRight
}
 Where an anchored element sits relative to its target: one horizontal and one vertical AnchorPlacementAxis value, one per nibble. More...
enum class  tachyon::AnchorPlacementAxis : uint8_t {
  tachyon::AnchorPlacementAxis::None = 0 , tachyon::AnchorPlacementAxis::OutsideMin = 1 , tachyon::AnchorPlacementAxis::CenterMin = 2 , tachyon::AnchorPlacementAxis::InsideMin = 3 ,
  tachyon::AnchorPlacementAxis::Center = 4 , tachyon::AnchorPlacementAxis::InsideMax = 5 , tachyon::AnchorPlacementAxis::CenterMax = 6 , tachyon::AnchorPlacementAxis::OutsideMax = 7
}
 Anchor placement along one axis; the 4-bit value of one AnchorPlacement nibble. More...
enum class  tachyon::BreakBehavior : uint8_t { tachyon::BreakBehavior::Auto , tachyon::BreakBehavior::Always , tachyon::BreakBehavior::Before , tachyon::BreakBehavior::Avoid }
 Line breaks around an item in a wrapping flex container (CSS: break-after). More...
enum class  tachyon::MouseCursor : uint8_t {
  tachyon::MouseCursor::Default , tachyon::MouseCursor::Text , tachyon::MouseCursor::Wait , tachyon::MouseCursor::Crosshair ,
  tachyon::MouseCursor::Pointer , tachyon::MouseCursor::ColResize , tachyon::MouseCursor::RowResize , tachyon::MouseCursor::EwResize ,
  tachyon::MouseCursor::NsResize , tachyon::MouseCursor::NwseResize , tachyon::MouseCursor::NeswResize , tachyon::MouseCursor::Move ,
  tachyon::MouseCursor::NotAllowed , tachyon::MouseCursor::None
}
 Mouse cursor shown over an element (CSS: cursor). More...
enum class  tachyon::ColorType : uint16_t {
  tachyon::ColorType::SolidColor = 0 , tachyon::ColorType::StretchedTexture = 1 , tachyon::ColorType::RepeatedTexture = 2 , tachyon::ColorType::LinearGradient = 3 ,
  tachyon::ColorType::CircularAngularGradient = 4 , tachyon::ColorType::EllipsoidAngularGradient = 5 , tachyon::ColorType::RadialGradient = 6 , tachyon::ColorType::InterpolatedTriangle = 7 ,
  tachyon::ColorType::InterpolatedBox = 8 , tachyon::ColorType::SDFGradient = 9
}
 How a ColorStyle paints a shape. More...
enum class  tachyon::StateLayer : uint8_t { tachyon::StateLayer::None , tachyon::StateLayer::Content }
 How a style's hover and pressed backgrounds are made. More...
enum class  tachyon::GradientType : uint8_t { tachyon::GradientType::None , tachyon::GradientType::Linear , tachyon::GradientType::Radial }
 Kind of Gradient. More...
enum class  tachyon::ColorSpace : uint8_t {
  tachyon::ColorSpace::sRGB , tachyon::ColorSpace::LinearRGB , tachyon::ColorSpace::HSL , tachyon::ColorSpace::HSV ,
  tachyon::ColorSpace::Lab , tachyon::ColorSpace::Oklab
}
 The space gradient stops are interpolated in. More...
enum class  tachyon::StyleUnits : uint8_t { tachyon::StyleUnits::Css , tachyon::StyleUnits::Pixels }
 Units of a style's metrics: CSS pixels (scaled to the UI) or final pixels. More...
enum class  tachyon::LayoutStyleIndex : uint32_t { tachyon::LayoutStyleIndex::Invalid = 0 }
 Index into StyleManager's layout style pool; Invalid (0) = none. More...
enum class  tachyon::VisualBoxStyleIndex : uint16_t { tachyon::VisualBoxStyleIndex::Invalid = 0 }
 Index into StyleManager's visual box style pool; Invalid (0) = none. More...
enum class  tachyon::VisualTextStyleIndex : uint16_t { tachyon::VisualTextStyleIndex::Invalid = 0 }
 Index into StyleManager's visual text style pool; Invalid (0) = none. More...
enum class  tachyon::TextID : uint32_t { tachyon::TextID::Invalid = 0 }
 Handle for text registered with the text system (ITextSystem::RegisterText and friends). More...
enum class  tachyon::IconID : uint32_t { tachyon::IconID::Invalid = 0 }
 Handle for an icon registered with ITextSystem::RegisterIconFromSVG / RegisterIconFromSVGFile. More...
enum class  tachyon::FontID : uint32_t { tachyon::FontID::Invalid = 0 }
 Handle for a font family registered with ITextSystem::RegisterFontFamily(). More...
enum class  tachyon::TextDirection : uint8_t { tachyon::TextDirection::Auto , tachyon::TextDirection::LeftToRight , tachyon::TextDirection::RightToLeft }
 Writing direction of text (CSS: direction). More...
enum class  tachyon::TextWrap : uint8_t { tachyon::TextWrap::NoWrap = 0 , tachyon::TextWrap::Wrap , tachyon::TextWrap::WordChar }
 How text wraps in its box (CSS: text-wrap). More...
enum class  tachyon::TextAlign : uint8_t {
  tachyon::TextAlign::Start = 0 , tachyon::TextAlign::Center , tachyon::TextAlign::End , tachyon::TextAlign::Left ,
  tachyon::TextAlign::Right , tachyon::TextAlign::Top , tachyon::TextAlign::Bottom
}
 Alignment of text in its box (CSS: text-align, -tachyon-vertical-text-align). More...
enum class  tachyon::TextBaseline : uint8_t {
  tachyon::TextBaseline::Alphabetic , tachyon::TextBaseline::Ideographic , tachyon::TextBaseline::Central , tachyon::TextBaseline::Hanging ,
  tachyon::TextBaseline::Mathematical , tachyon::TextBaseline::Middle , tachyon::TextBaseline::TextTop , tachyon::TextBaseline::TextBottom ,
  tachyon::TextBaseline::Max
}
 Font baseline that text aligns on (TextLayoutStyle::baseline). More...
enum class  tachyon::DecorationStyle : uint8_t {
  tachyon::DecorationStyle::Solid = 0 , tachyon::DecorationStyle::Double , tachyon::DecorationStyle::Dotted , tachyon::DecorationStyle::Dashed ,
  tachyon::DecorationStyle::Wavy
}
 Line style of a TextDecoration. More...
enum class  tachyon::FontFamily : uint8_t {
  tachyon::FontFamily::Default , tachyon::FontFamily::Emoji , tachyon::FontFamily::SansSerif , tachyon::FontFamily::Serif ,
  tachyon::FontFamily::Monospace , tachyon::FontFamily::Math
}
 Generic font family, used when TextStyle::fontId names no registered family. More...
enum class  tachyon::FontWeight : uint8_t {
  tachyon::FontWeight::Normal , tachyon::FontWeight::Thin , tachyon::FontWeight::ExtraLight , tachyon::FontWeight::UltraLight ,
  tachyon::FontWeight::Light , tachyon::FontWeight::Regular , tachyon::FontWeight::Medium , tachyon::FontWeight::DemiBold ,
  tachyon::FontWeight::SemiBold , tachyon::FontWeight::Bold , tachyon::FontWeight::ExtraBold , tachyon::FontWeight::UltraBold ,
  tachyon::FontWeight::Black , tachyon::FontWeight::Heavy , tachyon::FontWeight::ExtraBlack , tachyon::FontWeight::UltraBlack
}
 Font weight (CSS: font-weight); the CSS weight is in parentheses. More...
enum class  tachyon::FontStyle : uint8_t { tachyon::FontStyle::Normal = 0 , tachyon::FontStyle::Italic , tachyon::FontStyle::Oblique }
 Font slant (CSS: font-style). More...
enum class  tachyon::FontStretch : uint8_t {
  tachyon::FontStretch::Normal = 0 , tachyon::FontStretch::UltraCondensed , tachyon::FontStretch::ExtraCondensed , tachyon::FontStretch::Condensed ,
  tachyon::FontStretch::SemiCondensed , tachyon::FontStretch::SemiExpanded , tachyon::FontStretch::Expanded , tachyon::FontStretch::ExtraExpanded ,
  tachyon::FontStretch::UltraExpanded
}
 Font width (CSS: font-stretch); the width factor is in parentheses. More...
enum class  tachyon::LineHeight : uint8_t { tachyon::LineHeight::Normal = 0 , tachyon::LineHeight::MetricsRelative , tachyon::LineHeight::FontSizeRelative , tachyon::LineHeight::Absolute }
 How TextStyle::lineHeight is read. More...
enum class  tachyon::VerticalTrim : uint8_t { tachyon::VerticalTrim::Default = 0 , tachyon::VerticalTrim::CapToBaseline }
 Font metrics that bound a line for vertical alignment (CSS: -tachyon-vertical-trim). More...
enum class  tachyon::WordWrap : uint8_t { tachyon::WordWrap::None , tachyon::WordWrap::Normal , tachyon::WordWrap::BreakWord }
 Word wrapping mode of TextLayoutStyle::wrapMode. More...
enum class  tachyon::TextOverflow : uint8_t { tachyon::TextOverflow::Clip , tachyon::TextOverflow::Ellipsis }
 What happens to text that doesn't fit its box (CSS: text-overflow). More...
enum class  tachyon::DecorationLine : uint8_t { tachyon::DecorationLine::Under , tachyon::DecorationLine::Bottom , tachyon::DecorationLine::Over , tachyon::DecorationLine::Through }
 The decoration lines of a TextStyle; indexes StyleState::decorationColors. More...

Functions

float tachyon::ColorConvert::SRGBToLinear (float c)
float tachyon::ColorConvert::LinearToSRGB (float c)
void tachyon::ColorConvert::RGBtoHSV (float r, float g, float b, float &h, float &s, float &v)
std::array< float, 3 > tachyon::ColorConvert::HSVtoRGB (float h, float s, float v)
void tachyon::ColorConvert::RGBtoHSL (float r, float g, float b, float &h, float &s, float &l)
std::array< float, 3 > tachyon::ColorConvert::HSLtoRGB (float h, float s, float l)
void tachyon::ColorConvert::RGBtoLab (float r, float g, float b, float &L, float &a, float &bOut)
std::array< float, 3 > tachyon::ColorConvert::LabToRGB (float L, float a, float b)
void tachyon::ColorConvert::RGBtoOklab (float r, float g, float b, float &L, float &a, float &bOut)
std::array< float, 3 > tachyon::ColorConvert::OklabToRGB (float L, float a, float b)
 tachyon::TACHYON_ENUM_OPERATORS (AnchorPlacement)
constexpr AnchorPlacementAxis tachyon::FlipAxis (AnchorPlacementAxis p)
 Mirrors a placement: Min <-> Max; Center and None are unchanged.
constexpr AnchorPlacementAxis tachyon::GetHorizontalAxis (AnchorPlacement p)
 Horizontal part of an AnchorPlacement.
constexpr AnchorPlacementAxis tachyon::GetVerticalAxis (AnchorPlacement p)
 Vertical part of an AnchorPlacement.
constexpr AnchorPlacement tachyon::MakeAnchorPlacement (AnchorPlacementAxis h, AnchorPlacementAxis v)
 Combines a horizontal and a vertical placement.
StyleSheet tachyon::ParseStyleSheet (std::string_view source)
 Parses a theme's CSS (the subset TachyonUI supports, see docs/css.md) into a StyleSheet.
FontID tachyon::FontIDFromName (std::string_view familyName)
 Case-insensitive, like CSS family names. Returns FontID::Invalid for an empty name.

Variables

constexpr int tachyon::kMaxBoxShadows = 2
 CSS box-shadow layers per state; the first is drawn on top.
constexpr int tachyon::kMaxTextShadows = kMaxBoxShadows
 CSS text-shadow layers per state; the first is drawn on top.

Detailed Description

Themes, styles, colors and gradients.

See CSS and theming for the CSS the themes are written in.

Typedef Documentation

◆ VisualBoxStyleStates

#include <gui_core/style/gui_style_manager.h>

A box style's variants, one per visual element state (Style::kStateCount).

◆ VisualTextStyleStates

#include <gui_core/style/gui_style_manager.h>

A text style's variants, one per visual element state (Style::kStateCount).

Enumeration Type Documentation

◆ VisualColorStyleIndex

enum class tachyon::VisualColorStyleIndex : uint16_t
strong

#include <gui_core/style/gui_style.h>

Index into StyleManager's color style pool; Invalid (0) draws nothing (transparent).

Enumerator
Invalid 

◆ ElementState

enum class tachyon::ElementState : uint8_t
strong

#include <gui_core/style/gui_style.h>

Interaction state bits of an element; they pick the Style::states variant it draws with.

Enumerator
None 
Active 

being pressed or dragged (CSS: :active)

Hover 

under the mouse (CSS: :hover)

Focused 

has keyboard focus (CSS: :focus)

Selected 

selected item (CSS: :selected)

Selection 

text-selection highlight; combines with Active, Hover, Focused, Selected

Disabled 

exclusive: overrides every other visual bit

Invalid 

Its value isn't accepted (BeginInvalid).

Not a style slot: the topmost invalid element gets the theme's error border and halo over whatever state it's in.

VisualMask 

◆ FlexDirection

enum class tachyon::FlexDirection : uint8_t
strong

#include <gui_core/style/gui_style.h>

Main axis of a flex container (CSS: flex-direction).

Enumerator
Row 

Horizontal, left to right.

RowReverse 

Horizontal, right to left.

Column 

Vertical, top to bottom.

ColumnReverse 

Vertical, bottom to top.

◆ FlexWrap

enum class tachyon::FlexWrap : uint8_t
strong

#include <gui_core/style/gui_style.h>

Whether flex items wrap onto more lines (CSS: flex-wrap).

Enumerator
NoWrap 

Single line.

Wrap 

Multi-line.

WrapReverse 

Multi-line, reversed.

◆ AlignItems

enum class tachyon::AlignItems : uint8_t
strong

#include <gui_core/style/gui_style.h>

Cross-axis alignment of items (CSS: align-items, align-self).

Enumerator
Auto 

align-self only: inherit from container's align-items

FlexStart 

Align to start of cross axis.

FlexEnd 

Align to end of cross axis.

Center 

Center on cross axis.

Stretch 

Stretch to fill container.

◆ JustifyContent

enum class tachyon::JustifyContent : uint8_t
strong

#include <gui_core/style/gui_style.h>

Main-axis distribution of items (CSS: justify-content; grids also justify-items).

Enumerator
FlexStart 

Pack to start.

FlexEnd 

Pack to end.

Center 

Pack to center.

SpaceBetween 

Space between items.

SpaceAround 

Space around items.

SpaceEvenly 

Equal space between all items.

◆ AlignContent

enum class tachyon::AlignContent : uint8_t
strong

#include <gui_core/style/gui_style.h>

Distributes cross-axis space between wrap lines (align-items aligns within a line).

Only applies when flex-wrap != NoWrap.

Enumerator
FlexStart 

Pack lines to start (default here; no stretching).

FlexEnd 

Pack lines to end.

Center 

Pack lines to center.

Stretch 

Lines grow to fill the container's cross axis.

SpaceBetween 

Space between lines.

SpaceAround 

Space around lines.

SpaceEvenly 

Equal space between all lines.

◆ PositionType

enum class tachyon::PositionType : uint8_t
strong

#include <gui_core/style/gui_style.h>

How an element is positioned; modeled on CSS position, but set in code, not CSS.

Enumerator
Relative 

in flow, offset from its natural position

Anchored 

placed relative to another element (AnchorPlacement)

Absolute 

out of flow in content space; scrolls with the parent

Fixed 

out of flow in overlay space; doesn't scroll with the parent

Centered 

centered in the parent

Sticky 

in flow like Relative, clamped to the parent's scroll viewport edge

◆ Display

enum class tachyon::Display : uint8_t
strong

#include <gui_core/style/gui_style.h>

How an element lays out its children (CSS: display).

Enumerator
Flex 

Flexbox container.

Grid 

Grid container.

None 

Not rendered, removed from layout.

◆ Overflow

enum class tachyon::Overflow : uint8_t
strong

#include <gui_core/style/gui_style.h>

What happens to content larger than the box (CSS: overflow, overflow-x, overflow-y).

Enumerator
Auto 

Content clipped, scrollbars shown when needed.

Hidden 

Content clipped, no scrollbars.

Visible 

Content not clipped.

◆ Visibility

enum class tachyon::Visibility : uint8_t
strong

#include <gui_core/style/gui_style.h>

CSS: visibility.

Enumerator
Visible 

Rendered normally.

Collapsed 

Not rendered, removed from layout.

◆ IconSide

enum class tachyon::IconSide : uint8_t
strong

#include <gui_core/style/gui_style.h>

Where an element's icon sits relative to its text (CSS: -tachyon-icon-side).

Enumerator
None 
Left 
Right 
Top 
Bottom 

◆ AnchorPlacement

enum class tachyon::AnchorPlacement : uint8_t
strong

#include <gui_core/style/gui_style.h>

Where an anchored element sits relative to its target: one horizontal and one vertical AnchorPlacementAxis value, one per nibble.

Outside = beyond the target's edge, Inside = within it, Center* = centered on that edge.

Enumerator
None 
OutsideLeft 
CenterLeft 
InsideLeft 
CenterHorz 
InsideRight 
CenterRight 
OutsideRight 
HorizontalMask 
OutsideTop 
CenterTop 
InsideTop 
CenterVert 
InsideBottom 
CenterBottom 
OutsideBottom 
VerticalMask 
CenterCenter 
InsideTopLeft 
InsideTopRight 
InsideBottomLeft 
InsideBottomRight 
OutsideTopLeft 
OutsideTopRight 
OutsideBottomLeft 
OutsideBottomRight 

◆ AnchorPlacementAxis

enum class tachyon::AnchorPlacementAxis : uint8_t
strong

#include <gui_core/style/gui_style.h>

Anchor placement along one axis; the 4-bit value of one AnchorPlacement nibble.

Enumerator
None 
OutsideMin 

beyond the near edge (left / top)

CenterMin 

centered on the near edge

InsideMin 

inside, against the near edge

Center 

centered in the target

InsideMax 

inside, against the far edge (right / bottom)

CenterMax 

centered on the far edge

OutsideMax 

beyond the far edge (right / bottom)

◆ BreakBehavior

enum class tachyon::BreakBehavior : uint8_t
strong

#include <gui_core/style/gui_style.h>

Line breaks around an item in a wrapping flex container (CSS: break-after).

Enumerator
Auto 

No forced breaks, no keep-with-next.

Always 

Force a line break after this element (CSS: always / right).

Before 

Force a line break before this element (CSS: left).

Avoid 

Prevent a line break between this and the next element (CSS: avoid).

◆ MouseCursor

enum class tachyon::MouseCursor : uint8_t
strong

#include <gui_core/style/gui_style.h>

Mouse cursor shown over an element (CSS: cursor).

Enumerator
Default 

Default arrow cursor.

Text 

Text editing I-beam.

Wait 

Wait/busy cursor.

Crosshair 

Crosshair for precision selection.

Pointer 

Pointing hand for clickable items.

ColResize 

CSS col-resize: edge of a column being moved (left/right).

RowResize 

CSS row-resize: edge of a row being moved (up/down).

EwResize 

CSS ew-resize: bidirectional east-west arrow (left/right movement).

NsResize 

CSS ns-resize: bidirectional north-south arrow (up/down movement).

NwseResize 

CSS nwse-resize: diagonal (northwest-southeast).

NeswResize 

CSS nesw-resize: diagonal (northeast-southwest).

Move 

CSS move: 4-way arrow (free movement).

NotAllowed 

CSS not-allowed.

None 

No cursor (invisible).

◆ ColorType

enum class tachyon::ColorType : uint16_t
strong

#include <gui_core/style/gui_style.h>

How a ColorStyle paints a shape.

Gradient types sample the gradient ramp along a coordinate that the style's transformation and animSpeed move.

Enumerator
SolidColor 

the first stop's color

StretchedTexture 

Style::textureIndex stretched over the box.

RepeatedTexture 

Style::textureIndex tiled at its pixel size.

LinearGradient 

ramp along an axis (CSS: linear-gradient)

CircularAngularGradient 

ramp by distance from the center

EllipsoidAngularGradient 

ramp by distance from the center, relative to the box size

RadialGradient 

ramp by angle around the center (CSS: radial-gradient)

InterpolatedTriangle 

three colors blended by vertex weights

InterpolatedBox 

four corner colors blended across the box

SDFGradient 

ramp by depth inside the shape: 0 on its edge, 1 at its deepest point (a box's middle, a stroke's center line, a triangle's incenter); the transformation's first row maps it (t = x.x * depth + x.z), so the identity runs the ramp edge to middle

◆ StateLayer

enum class tachyon::StateLayer : uint8_t
strong

#include <gui_core/style/gui_style.h>

How a style's hover and pressed backgrounds are made.

Enumerator
None 

as the CSS gives them

Content 

the state's text color over its background: 8% hovered, 14% pressed

◆ GradientType

enum class tachyon::GradientType : uint8_t
strong

#include <gui_core/style/gui_style_gradient.h>

Kind of Gradient.

None marks an empty gradient; the shape a color style draws comes from ColorStyle::type.

Enumerator
None 
Linear 
Radial 

◆ ColorSpace

enum class tachyon::ColorSpace : uint8_t
strong

#include <gui_core/style/gui_style_gradient.h>

The space gradient stops are interpolated in.

Enumerator
sRGB 

the default, as CSS

LinearRGB 
HSL 
HSV 
Lab 

CIE Lab, perceptual.

Oklab 

perceptual

◆ StyleUnits

enum class tachyon::StyleUnits : uint8_t
strong

#include <gui_core/style/gui_style_manager.h>

Units of a style's metrics: CSS pixels (scaled to the UI) or final pixels.

Enumerator
Css 
Pixels 

◆ LayoutStyleIndex

enum class tachyon::LayoutStyleIndex : uint32_t
strong

#include <gui_core/style/gui_style_ref.h>

Index into StyleManager's layout style pool; Invalid (0) = none.

Enumerator
Invalid 

◆ VisualBoxStyleIndex

enum class tachyon::VisualBoxStyleIndex : uint16_t
strong

#include <gui_core/style/gui_style_ref.h>

Index into StyleManager's visual box style pool; Invalid (0) = none.

Enumerator
Invalid 

◆ VisualTextStyleIndex

enum class tachyon::VisualTextStyleIndex : uint16_t
strong

#include <gui_core/style/gui_style_ref.h>

Index into StyleManager's visual text style pool; Invalid (0) = none.

Enumerator
Invalid 

◆ TextID

enum class tachyon::TextID : uint32_t
strong

#include <gui_core/style/gui_style_text.h>

Handle for text registered with the text system (ITextSystem::RegisterText and friends).

Enumerator
Invalid 

◆ IconID

enum class tachyon::IconID : uint32_t
strong

#include <gui_core/style/gui_style_text.h>

Handle for an icon registered with ITextSystem::RegisterIconFromSVG / RegisterIconFromSVGFile.

Enumerator
Invalid 
Examples
docking/docking.cpp.

◆ FontID

enum class tachyon::FontID : uint32_t
strong

#include <gui_core/style/gui_style_text.h>

Handle for a font family registered with ITextSystem::RegisterFontFamily().

Derived from the family name, so styles can name a family before it is registered. Use FontID::Invalid for the default / family-based font selection.

Enumerator
Invalid 

◆ TextDirection

enum class tachyon::TextDirection : uint8_t
strong

#include <gui_core/style/gui_style_text.h>

Writing direction of text (CSS: direction).

Enumerator
Auto 

inferred from the text

LeftToRight 
RightToLeft 

◆ TextWrap

enum class tachyon::TextWrap : uint8_t
strong

#include <gui_core/style/gui_style_text.h>

How text wraps in its box (CSS: text-wrap).

Enumerator
NoWrap 

a single line (nowrap)

Wrap 

at word boundaries; a word longer than the box overflows (wrap)

WordChar 

at word boundaries; a word longer than the box breaks between characters (word-char)

◆ TextAlign

enum class tachyon::TextAlign : uint8_t
strong

#include <gui_core/style/gui_style_text.h>

Alignment of text in its box (CSS: text-align, -tachyon-vertical-text-align).

Enumerator
Start 

Horizontal: the language's start (left for LTR, right for RTL). Vertical: top.

Center 

Horizontal and vertical: center.

End 

Horizontal: the language's end (right for LTR, left for RTL). Vertical: bottom.

Left 

Horizontal: left. Vertical: n/a (behaves like top).

Right 

Horizontal: right. Vertical: n/a (behaves like bottom).

Top 

Horizontal: n/a (behaves like left). Vertical: top.

Bottom 

Horizontal: n/a (behaves like right). Vertical: bottom.

◆ TextBaseline

enum class tachyon::TextBaseline : uint8_t
strong

#include <gui_core/style/gui_style_text.h>

Font baseline that text aligns on (TextLayoutStyle::baseline).

Enumerator
Alphabetic 

alphabetic (roman) baseline

Ideographic 

ideographic baseline

Central 

ideographic central baseline

Hanging 

hanging baseline

Mathematical 

mathematical baseline

Middle 

the middle of the x-height

TextTop 

top of the text

TextBottom 

bottom of the text

Max 

count, not a baseline

◆ DecorationStyle

enum class tachyon::DecorationStyle : uint8_t
strong

#include <gui_core/style/gui_style_text.h>

Line style of a TextDecoration.

Enumerator
Solid 

solid line

Double 

double line

Dotted 

dotted line

Dashed 

dashed line

Wavy 

wavy line

◆ FontFamily

enum class tachyon::FontFamily : uint8_t
strong

#include <gui_core/style/gui_style_text.h>

Generic font family, used when TextStyle::fontId names no registered family.

Enumerator
Default 

the text system's default family

Emoji 

emoji; assigned to emoji automatically

SansSerif 

sans-serif

Serif 

serif

Monospace 

monospace

Math 

math

◆ FontWeight

enum class tachyon::FontWeight : uint8_t
strong

#include <gui_core/style/gui_style_text.h>

Font weight (CSS: font-weight); the CSS weight is in parentheses.

Enumerator
Normal 

Normal (400); the zero-initialized default.

Thin 

Thin (100).

ExtraLight 

Extra light (200).

UltraLight 

Ultra light (200).

Light 

Light (300).

Regular 

Regular (400).

Medium 

Medium (500).

DemiBold 

Demibold (600).

SemiBold 

Semibold (600).

Bold 

Bold (700).

ExtraBold 

Extra bold (800).

UltraBold 

Ultra bold (800).

Black 

Black (900).

Heavy 

Heavy (900).

ExtraBlack 

Extra black (950).

UltraBlack 

Ultra black (950).

◆ FontStyle

enum class tachyon::FontStyle : uint8_t
strong

#include <gui_core/style/gui_style_text.h>

Font slant (CSS: font-style).

Enumerator
Normal 

upright

Italic 

italic

Oblique 

oblique

◆ FontStretch

enum class tachyon::FontStretch : uint8_t
strong

#include <gui_core/style/gui_style_text.h>

Font width (CSS: font-stretch); the width factor is in parentheses.

Enumerator
Normal 

Normal (1.0); the zero-initialized default.

UltraCondensed 

Ultra condensed (0.5).

ExtraCondensed 

Extra condensed (0.625).

Condensed 

Condensed (0.75).

SemiCondensed 

Semi condensed (0.875).

SemiExpanded 

Semi expanded (1.125).

Expanded 

Expanded (1.25).

ExtraExpanded 

Extra expanded (1.5).

UltraExpanded 

Ultra expanded (2.0).

◆ LineHeight

enum class tachyon::LineHeight : uint8_t
strong

#include <gui_core/style/gui_style_text.h>

How TextStyle::lineHeight is read.

Enumerator
Normal 

the font's metrics; lineHeight is ignored

MetricsRelative 

a multiple of the font's metric line height

FontSizeRelative 

a multiple of the font size

Absolute 

the value itself

◆ VerticalTrim

enum class tachyon::VerticalTrim : uint8_t
strong

#include <gui_core/style/gui_style_text.h>

Font metrics that bound a line for vertical alignment (CSS: -tachyon-vertical-trim).

Enumerator
Default 

ascender to descender; leaves room for accents

CapToBaseline 

cap height to baseline; tight, visually centered for widgets

◆ WordWrap

enum class tachyon::WordWrap : uint8_t
strong

#include <gui_core/style/gui_style_text.h>

Word wrapping mode of TextLayoutStyle::wrapMode.

The text system doesn't read it; wrapping is set by TextLayoutStyle::textWrapping (TextWrap).

Enumerator
None 

single line

Normal 

break at word boundaries

BreakWord 

break within words when needed

◆ TextOverflow

enum class tachyon::TextOverflow : uint8_t
strong

#include <gui_core/style/gui_style_text.h>

What happens to text that doesn't fit its box (CSS: text-overflow).

Enumerator
Clip 

clip the text

Ellipsis 

end with "..."

◆ DecorationLine

enum class tachyon::DecorationLine : uint8_t
strong

Function Documentation

◆ SRGBToLinear()

float tachyon::ColorConvert::SRGBToLinear ( float c)
inline

◆ LinearToSRGB()

float tachyon::ColorConvert::LinearToSRGB ( float c)
inline

◆ RGBtoHSV()

void tachyon::ColorConvert::RGBtoHSV ( float r,
float g,
float b,
float & h,
float & s,
float & v )
inline

◆ HSVtoRGB()

std::array< float, 3 > tachyon::ColorConvert::HSVtoRGB ( float h,
float s,
float v )
inline

◆ RGBtoHSL()

void tachyon::ColorConvert::RGBtoHSL ( float r,
float g,
float b,
float & h,
float & s,
float & l )
inline

◆ HSLtoRGB()

std::array< float, 3 > tachyon::ColorConvert::HSLtoRGB ( float h,
float s,
float l )
inline

◆ RGBtoLab()

void tachyon::ColorConvert::RGBtoLab ( float r,
float g,
float b,
float & L,
float & a,
float & bOut )
inline

◆ LabToRGB()

std::array< float, 3 > tachyon::ColorConvert::LabToRGB ( float L,
float a,
float b )
inline

◆ RGBtoOklab()

void tachyon::ColorConvert::RGBtoOklab ( float r,
float g,
float b,
float & L,
float & a,
float & bOut )
inline

◆ OklabToRGB()

std::array< float, 3 > tachyon::ColorConvert::OklabToRGB ( float L,
float a,
float b )
inline

◆ TACHYON_ENUM_OPERATORS()

tachyon::TACHYON_ENUM_OPERATORS ( AnchorPlacement )

◆ FlipAxis()

AnchorPlacementAxis tachyon::FlipAxis ( AnchorPlacementAxis p)
constexpr

#include <gui_core/style/gui_style.h>

Mirrors a placement: Min <-> Max; Center and None are unchanged.

◆ GetHorizontalAxis()

AnchorPlacementAxis tachyon::GetHorizontalAxis ( AnchorPlacement p)
constexpr

#include <gui_core/style/gui_style.h>

Horizontal part of an AnchorPlacement.

◆ GetVerticalAxis()

AnchorPlacementAxis tachyon::GetVerticalAxis ( AnchorPlacement p)
constexpr

#include <gui_core/style/gui_style.h>

Vertical part of an AnchorPlacement.

◆ MakeAnchorPlacement()

AnchorPlacement tachyon::MakeAnchorPlacement ( AnchorPlacementAxis h,
AnchorPlacementAxis v )
constexpr

#include <gui_core/style/gui_style.h>

Combines a horizontal and a vertical placement.

◆ ParseStyleSheet()

StyleSheet tachyon::ParseStyleSheet ( std::string_view source)

#include <gui_core/style/gui_style_sheet.h>

Parses a theme's CSS (the subset TachyonUI supports, see docs/css.md) into a StyleSheet.

Errors don't stop it: a bad declaration or rule is skipped and reported in StyleSheet::errors, and the rest is parsed.

◆ FontIDFromName()

FontID tachyon::FontIDFromName ( std::string_view familyName)

#include <gui_core/style/gui_style_text.h>

Case-insensitive, like CSS family names. Returns FontID::Invalid for an empty name.

Variable Documentation

◆ kMaxBoxShadows

int tachyon::kMaxBoxShadows = 2
inlineconstexpr

#include <gui_core/style/gui_style.h>

CSS box-shadow layers per state; the first is drawn on top.

◆ kMaxTextShadows

int tachyon::kMaxTextShadows = kMaxBoxShadows
inlineconstexpr

#include <gui_core/style/gui_style.h>

CSS text-shadow layers per state; the first is drawn on top.