Theme & resource packs
Every colour and spacing of Galdur UI comes from one file, theme.json. It is reloaded with resources, and a resource pack can change all or part of it.
theme.json
assets/galdurui/theme.json is the single source of the style guide: colours, and spacings in the spacing section.
{ "background": "#2A2420", "surface": "#352E29", "text": "#F8F3E8", "text_muted": "#C9BEAD", "accent": "#B8341F", "accent_hover": "#D9573D", "accent_pressed": "#952A18", "ember": "#D98A1F", "spacing": { "panel_padding": 16, "gap": 8, "button_padding_x": 6, "button_min_width": 40, "button_height": 20, "list_row_height": 12, "scrollbar_width": 4, "field_height": 16, "tab_height": 16, "tab_padding_x": 8, "progress_height": 12 }}Colours
| Key | Used for |
|---|---|
background | Main screen background (charcoal). |
surface | Elements placed on the background: lists, fields. |
text | Main text colour (cream). |
text_muted | Secondary, less contrasted text. |
accent | Accent colour at rest (redstone). |
accent_hover | Accent under the mouse or keyboard focus. |
accent_pressed | Accent while pressed. |
ember | Warm secondary colour, for highlights. |
Write colours as "#RRGGBB" (opaque) or "#AARRGGBB". A JSON integer is accepted; if it fits in 24 bits (≤ 0xFFFFFF, so no alpha byte), it is read as opaque RRGGBB with a warning in the log, rather than giving an invisible colour.
Spacings are in GUI pixels. They apply the next time a screen is built.
Change it with a resource pack
Ship a theme.json at the same path in a resource pack: assets/galdurui/theme.json. It can be partial: the file from the jar provides the defaults for every missing key.
{ "background": "#18222E", "surface": "#22303F", "accent": "#2F6FB8", "accent_hover": "#4F8FD9", "accent_pressed": "#24568F", "ember": "#3FC1D9", "spacing": { "button_height": 24, "gap": 12 }}This is the blue theme pack shipped by the test mod (Options → Resource Packs). text and most spacings are missing, so they fall back to the defaults. An invalid colour (not #RRGGBB or #AARRGGBB) logs a warning and keeps the default too.
Minecraft ignores F3+T while a screen is open. In /galdurui test, use the "Reload theme" button.
Read the theme in code
GaldurTheme gives colours as packed ARGB (0xAARRGGBB), the format Minecraft's rendering methods expect, and spacings in pixels.
int accent = GaldurTheme.accent();int gap = GaldurTheme.gap();int custom = GaldurTheme.colorOrDefault("mymod_energy", 0xFF3FC1D9);Read colours and spacings every frame or every init(), never in a static final field: a resource pack can change them at any time.
Your own keys
A mod can read its own colour keys with colorOrDefault(key, fallback) and test them with has(key). A resource pack that wants to style your mod adds the key to its theme.json; without it, your fallback is used.
A themed panel around vanilla layouts
GaldurPanelLayout wraps any vanilla layout in a themed background panel, with the theme padding. Use it to give a hand-made Screen the same look as Galdur UI windows. The panel is drawn with a grayscale sprite tinted by the theme: see Sprites.