Sprites
Galdur UI draws panels, buttons and fields with grayscale 9-slice sprites tinted by the theme. Change the colours in theme.json without touching an image, or redraw the shapes in a resource pack.
Grayscale, tinted at render time
The sprites in assets/galdurui/textures/gui/sprites/ are grayscale. Their colour comes from the theme and is applied at render time: a white pixel takes exactly the theme colour. Changing the colours in theme.json therefore needs no new images; only the shape (corners, relief) is in the sprite.
The sprites
| Sprite | Size, border | Relief | Used by (tint) |
|---|---|---|---|
panel | 256, 4 | raised | GaldurPanelLayout (background) |
button, button_hover, button_pressed, button_disabled | 64, 4 | raised (pressed sunken) | GaldurButton, GaldurIconButton (accent by state, surface when disabled) |
field | 64, 4 | sunken | search field, list frame, checkbox (surface), progress bar track (background) |
slot | 64, 4 | sunken | GaldurItemSlot, GaldurItemGrid (background) |
tab, tab_selected | 64, 4 | raised, open at the bottom | GaldurTabs (surface, accent for the active tab) |
scrollbar_track, scrollbar_thumb | 32, 2 | sunken / raised | GaldurScrollList and GaldurItemGrid scrollbars (background, text_muted) |
Sprites with the same pixels (button / button_hover / button_disabled, field / slot, tab / tab_selected) stay separate on purpose, so a resource pack can redraw each state independently.
Redraw them in a resource pack
Put PNGs with the same names in assets/galdurui/textures/gui/sprites/ in your pack. Keep them grayscale if you want the theme colours to apply.
Minecraft 1.21.1 does not stretch the edges and centre of a 9-slice: it repeats them in tiles (sprite − 2 × border). Edges and centre must stay uniform, or the repetition shows. Large sprites keep the tile count low; Galdur UI sends all tiles of a sprite in a single draw call anyway.
Regenerate the built-in sprites
The built-in sprites are produced by a generator that describes their shape:
.\gradlew.bat generateSpritesThe generator (tools/GenerateSprites.java) is compiled in its own source set: it does not run during the build and is not in the mod jar. CI runs it again and fails if the committed PNGs no longer match its output.
Sprite icons on buttons
addIconButton also takes a ResourceLocation sprite instead of an item. It is tinted with the theme text colour: provide it in grayscale too.