This document describes the in-game GUI styling system: a small, CSS-like language
optimized for simplicity and runtime performance. Style is defined in the same file as UI. The style is defined in [style] block:
[style] {
.some_class {
width: 50%;
}
}
type, .class, $id, parent > child (direct child), and pseudoclasses such as :hover.$id > .class > type > stylesheet order.Certain style attributes are inherited from a widget’s parent when the child doesn’t supply its own value. This keeps styles compact while allowing explicit overrides where needed.
font, font-size, color, opacity, visibility, and simple text-related attributes.font-size is computed with document DPI scale (see Document::setDPIScale).Rules:
$id, .class,
type selector, or earlier stylesheet rules).padding does not
implicitly force child padding values unless the child is left unset.parent > child affect matching and specificity but do not change
the fundamental inheritance mechanism.opacity composes multiplicatively through the hierarchy (effective opacity
is parent opacity multiplied by element opacity).Use the :hover pseudoclass to target elements while the mouse cursor is over
them.
Use it directly in style selectors:
[style] {
.button {
bg-color: #3a3a3a;
color: #ffffff;
}
.button:hover {
bg-color: #4a4a4a;
}
}
Notes:
.button:hover matches .button elements currently in hovered state.:hover participates in normal precedence rules and has class-level
specificity.color and bg-color accept #RRGGBB and #RRGGBBAA.