Skip to content

Object Reference

Leroy edited this page Feb 15, 2026 · 2 revisions

Object Reference

All UI elements in PainterJS are called Paint Objects. Every object shares a set of common properties.

Common Properties

These can be used on any object type.

Property Type Default Description
type String rectangle rectangle, gradient, text, item.
visible Bool true If false, the object is not rendered.
draw String ingame ingame (world view) or gui (HUD/Overlays).
x, y, z Expr 0 Position and Render Order (higher Z = on top).
w, h Expr 0 Width and Height.
alignX String left left, center, right.
alignY String top top, center, bottom.
moveX, moveY Expr 0 Additional translation offset.
expandW, expandH Expr 0 Additional dimension offset.
color Color/Expr white Global color tint. Supports Hex strings (#AARRGGBB), Integers, or expressions (e.g., hsv(time, 1, 1)).

Rectangle (type: 'rectangle')

Draws a solid color or a textured quad.

Property Type Description
texture String Resource path (e.g., minecraft:textures/block/stone.png).
u0, v0 Float Top-Left UV.
u1, v1 Float Bottom-Right UV.

Gradient (type: 'gradient')

Smoothly interpolates colors between corners.

Property Type Description
colorTL Color Top-Left color.
colorTR Color Top-Right color.
colorBL Color Bottom-Left color.
colorBR Color Bottom-Right color.
colorT, colorB Color Set Top or Bottom pair.
colorL, colorR Color Set Left or Right pair.

Text (type: 'text')

Renders text strings or components. Supports variable injection in strings (e.g., "Value: $my_var").

Property Type Description
text String Plain text string. Supports $var injection (e.g., "HP: $health").
textLines Array List of strings for multi-line display.
scale Float Scale multiplier.
shadow Bool Enable text shadow.
centered Bool Center text horizontally around its x position.
lineSpacing Float Space between lines.

Item (type: 'item')

Renders a 2D item icon.

Property Type Description
item String Item ID (e.g., minecraft:diamond).
overlay Bool Show stack count and durability.
customText String Replace stack count with custom text (requires overlay: true).
rotation Float Rotation in degrees.

Clone this wiki locally