DocsDesign

Style, tokens and fonts

Paint

Frames, buttons and shapes have a fill (a color or a $token), or a linear or radial gradient instead. An image fill paints an image over that, clipped to the corners, as cover, contain, stretch, tile or nine-slice. A nine-slice fill keeps the corners at their size and stretches the edges. Crop an image first to trim what the fill shows.

On top of the main fill, frames and buttons can stack extra fills and extra strokes, each with its own opacity, drawn under the children.

Property Notes
radius Per corner
border Drawn inside the layer, never affects layout
shadow x, y, blur, color
innerShadow x, y, blur, spread, color; above the fill, below the children
backdropBlur Blurs what is behind the layer (frosted glass)
layerBlur Blurs the layer itself and its children
opacity, clip Group opacity and clipping

In Godot, paint becomes a StyleBoxFlat; gradients, shapes and blurs are drawn by the addon’s paint and shader code. See known differences for the small places the two runtimes differ. On the web, nine-slice fills work on frames and buttons, not on shapes.

Picking colors

Open the color picker on a text color, apply a color from In this document, then a token and a Recent color, and undo.

Click a color swatch in the inspector to open the picker: a saturation and brightness square, hue and opacity sliders, and hex and opacity fields. Under them:

  • Tokens: the document’s color tokens.
  • Recent: the last nine colors you applied, kept by the editor (not in the document).
  • In this document: up to 18 colors your layers use, most used first. Colors set by a token are left out, since they are in Tokens.

The eyedropper (or I while the picker is open) picks a color anywhere on the screen and keeps the current opacity; Esc cancels it. It is in the Windows app. The Linux build’s web view has no eyedropper, so there the button is hidden.

The opacity field applies on Enter or when you leave it, like the other number fields. Each pick is one undo step. With the keyboard, the arrows move the square and sliders (Shift for bigger steps) and move along a row of swatches.

Color tokens

Every color can be a token: write $ember instead of #f2a24e. Change the token and every layer that uses it follows, on every screen. Theme presets in the Game UI kit are sets of token values.

Text

Text layers have content, font, size, weight, color, alignment, line height, letter spacing, wrapping, uppercase, an outline and a shadow. In Godot they become a Label with LabelSettings.

Text styles are shared typography (Display, Title, Button, Body…). A layer that uses a style follows it, so changing one style restyles every screen.

Text can include data: HP {player.hp} / {player.hpMax} updates as the game sets data. It can also work values out, as in {player.hp / player.hpMax | percent}. See Data and events and Expressions.

Rich text

Part of a text can have its own style. Double-click a selected text layer, or press Enter, to edit it on the canvas, then select some words. A small bar appears over the selection with Bold, Italic, a color, a size and Clear styling. Each action is one undo step.

Each styled stretch is a run. A run can set weight, italic, color (a value or a $token) and size. Whatever it leaves out comes from the text. The font, line height and alignment belong to the whole text, so one text has one font family. content always holds the plain words, so a runtime that doesn’t know runs still shows the text.

"text": {
  "content": "Deal {damage} damage",
  "runs": [
    { "text": "Deal " },
    { "text": "{damage}", "weight": 700, "color": "$accent" },
    { "text": " damage" }
  ]
}
  • Data and expressions work inside a run. One {placeholder} can’t span two runs: it shows as written, and the document checks say so.
  • Text from data is only ever text. A value that holds [b] or <color=red> shows those characters. A text without runs never reads tags at all.
  • A text binding, or the label of a control, replaces the whole text and shows it plain.
  • On an instance, an override with runs brings its own words. An override with plain content replaces the styled parts. A text that shows a component property takes its words from the instance and has no styling bar.
  • A state’s Text color colors the words that have no color of their own. A run’s color stays.
  • The bar isn’t offered while the canvas shows a translation. A translation keeps the styling through tags: see Localization.

In Godot and Unity, rich text is drawn with each engine’s own tools: see known differences.

Shrink to fit

A text can lower its size until it fits its box, for names and prices that come from data or translations. In the inspector’s Text section, set Fit to Shrink. Min appears: the smallest size, 8 by default.

"text": { "content": "Continue your hunt", "size": 28, "fit": "shrink", "minSize": 16 }

The text keeps its own size if it fits. If not, it takes the largest whole size down to Min that does. Sizes in runs shrink by the same ratio, and letter spacing too. Outlines and shadows keep their pixels.

  • With Wrap lines on and a width limit, the words wrap at each size and only the height decides. With it off, width and height both have to fit.
  • What limits a text: both sides in free layout. In auto layout, a Fixed side, and a Fill side unless the parent scrolls that way. A Hug side follows the text, so it sets no limit, and a hugging text in auto layout never shrinks.
  • The default is None, and files without fit look as before. A minSize with no fit, or above the size, is a warning.
  • In the overflow and pseudo-locale checks, a shrinking text counts as fitting unless it reaches Min and still overflows. The Text fit row under Document health (in the document checks) lists those, and so does the handoff contract.
  • Every runtime uses the same rule but measures with its own text engine, so with different fonts the result can land a size or two apart.

Nine-slice margins

For an image layer, set Fit to Nine-slice in the Image section. The cropped image appears with four guides. Drag a guide, or focus it and use the arrow keys (Shift for 10 px). Under the image, a preview shows the layer at its size, drawn the way the runtimes draw it. The Slice fields show the same numbers, in source pixels after the crop. An image fill uses the number fields only.

Fonts

Envy has the whole Google Fonts catalog in its font picker. For the game, embed the fonts you use: the font files travel inside the document, and every runtime uses them with no setup.

  • On the web, the runtime registers each embedded font directly, so a strict content security policy can’t block it.
  • In Godot, EnvyUI builds a FontFile for each embedded face. An entry in EnvyUI.fonts for the same family still wins.

The Last Hunt · UI kit v2 embeds Jaini, Spectral Italic and Archivo at three widths: Archivo, Archivo 75 and Archivo 87.5. To embed a family, use Assets › Fonts, or Embed under the font picker.

Shapes

Ellipse, polygon, star, line and path. Draw paths with the pen tool (N): click for corners, drag for curves, and press Enter to finish. To edit the points later, select the path and double-click it, or choose Edit points in the inspector. Closed paths are filled and stroked, open paths are stroked. Both runtimes draw the same geometry. To bring in vector art, use File › Import SVG as layers…: rectangles become frames, and paths keep their curves. Text and images are left out, and the message says so. Filters, masks and clip paths are ignored.

Updated View as Markdown