gohud

Tokens

← Theming

Every colour and measurement lives under the GoHud type in the Theme, addressed by name. Not writing numbers is the rule: names follow along when the theme is swapped.

GoUi.color(GoTheme.ACCENT)             # colour
GoUi.metric(GoTheme.GAP)               # measurement (dp)
GoUi.font_size(GoTheme.ROLE_CAPTION)   # size for a text role
GoUi.box(GoTheme.BOX_CARD)             # a copy of a StyleBox

Colours

NameUsed for
backgroundThe screen floor
surface · surface_soft · surface_highThree panel layers — panel, card, raised cell
borderCard and button borders
text · secondary · mutedThree text levels — body, supporting, dimmed
accent · on_accentThe accent and the text placed on it
success · warning · danger · infoStatus text colours
*_fillThe same statuses as a fill — bars and other large areas
scrim · shadow · trackThe veil behind popups, shadows, the bar's trough
Why *_fill exists. The same meaning, opposite requirements. warning used as text must be dark enough to read on a light background; used as an experience bar's fill it must be bright enough to notice. One token cannot be both — the light theme's bar went brown. A theme without the _fill variant falls back to the base name automatically, so themes that predate these tokens keep working.

Measurements (dp)

touch button_height gap_tiny gap_small gap gap_large padding padding_compact compact_padding_x compact_padding_y radius_small radius radius_large screen_margin scroll_deadzone scroll_edge scrollbar_width list_glyph icon_size notice_duration_ms

Panel opacity (%)

panel_alpha card_alpha hud_alpha notice_alpha popup_alpha — how solid a container's face is. 80 by default, so the game stays visible behind a dialog; popup_alpha is 100. A theme without these tokens falls back to 100 and draws exactly as it did before. Read the resolved value as a ratio with GoUi.surface_alpha(variant); the section Opacity — the game behind the panel has the rules.

Text roles

micro · compact · caption · body · button · subtitle · title — a role names a size, not a purpose. "The largest text", not "the heading". That way the scale holds even when a screen uses it for something else.

Type variations

GoPanel GoCard GoButton GoPrimaryButton GoDangerButton GoDangerSolidButton GoBareButton GoCompactButton GoIconButton GoListButton GoTitleLabel GoSubtitleLabel GoCaptionLabel GoCompactLabel GoMicroLabel