Skip to content

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.

⏱ 4 minGaldur UI 0.1.0Client

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

SpriteSize, borderReliefUsed by (tint)
panel256, 4raisedGaldurPanelLayout (background)
button, button_hover, button_pressed, button_disabled64, 4raised (pressed sunken)GaldurButton, GaldurIconButton (accent by state, surface when disabled)
field64, 4sunkensearch field, list frame, checkbox (surface), progress bar track (background)
slot64, 4sunkenGaldurItemSlot, GaldurItemGrid (background)
tab, tab_selected64, 4raised, open at the bottomGaldurTabs (surface, accent for the active tab)
scrollbar_track, scrollbar_thumb32, 2sunken / raisedGaldurScrollList 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.

How Minecraft 1.21.1 draws a 9-slice

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:

Terminal
.\gradlew.bat generateSprites

The 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.

© 2026 Galdur Studio · galdurstudio.com · Discord · LGPL-3.0-onlyNot an official Minecraft product. Not approved by or associated with Mojang or Microsoft.