Style Studio

Tutorial · 3:07

Style Studio makes the look of your widgets. A button or a panel of the game is drawn from a style: a small image stretched to the widget's size, with a variant per state (hovered, pressed, disabled...). Here you describe styles with a few colours and a corner radius, see them live, and generate the three files the game needs: a texture atlas, an .imageset and a .styles file. The page also lists every style the game and your mods already define, and draws UI icons. You need it when the vanilla styles are not enough for a UI made in the Layout Editor. Nothing is required to start: the page opens on two sample styles.

The screen

First steps

  1. Open Style Studio. Two samples are there: MyPanel and MyButton.
  2. Click MyButton. In the right pane, change Hover: the hover image of its card changes.
  3. Rename it (for example MyModButton): this is the name layouts will use.
  4. In Generate, set Output name to a short name of your mod, for example mymod.
  5. Choose the Output folder: a folder inside your mod, for example MyMod/gui/looknfeel.
  6. Click Generate. The files are written and the Workbench reads its style list again.
  7. Click Save to keep the config as a JSON file, next to the generated files or anywhere in the mod.
  8. List the generated .imageset and .styles in the mod's config.cpp (see Concepts), then choose the style in the Layout Editor's style property.

Take the tour (in the app)

Common tasks

Add a style for another widget type

  1. Click + in the Styles header.
  2. In the right pane, give it a name and choose its Type: panel, button, editbox, checkbox, slider or progressbar.
  3. Fill the colours its states use: Hover and Active for a button, Focus for an edit box or a slider, Checked for a checkbox, Fill for a progress bar.
  4. Check each state on its card.

Change one state only

  1. Open the JSON tab.
  2. In the style, add "states": { "highlight": { "bg": "#262019" } }. The state keys are highlight, pushed, focus, disabled, checked and fill.
  3. Go back to Preview to see it.

Find a style that already exists

  1. Open the Library tab.
  2. Choose the widget class (for example ButtonWidget) and, if you want only the game's, the source Vanilla.
  3. Click the row of the style you like: its name is copied.
  4. Paste it in the style property of a widget in the Layout Editor, or in data-style in DZML.

Regenerate after a change

  1. Open the config from the header selector or with Open. The output folder is set to the config's folder if it was empty.
  2. Change the colours.
  3. Click Generate, then Save. The file names do not change, so config.cpp stays as it is.

Draw an icon

  1. Click New icon.
  2. Choose a template and edit its glyph (SVG elements on a 24 × 24 grid), or choose "Custom SVG" and paste a whole SVG document.
  3. Check the preview at 32, 64 and 128 px on dark and light backgrounds.
  4. Give a name, the mod folder, optionally the imageset to add it to, and the size. Click Save icon.
  5. The dialog then shows the line to use in a layout. An icon added to an imageset also needs that imageset listed in config.cpp.

The second tab of the dialog asks an image model for a realistic icon. It needs an OpenRouter key (developer mode), is billed to that key, and the button states the estimated price before anything is sent.

Examples

Concepts

Pitfalls

For agents

Tools of dzt that do the same work without the window:

Files:

What the page tells the assistant: the path of the open config (empty when not saved), the number of styles, the selected style as name (type), the output folder, whether there are unsaved edits, and the warnings of the last generation.

Examples of the help panel are requests the page handles: kit loads the example config, library opens the Library on the vanilla styles, library:<WidgetClass> on one widget class.

See also