Style Studio
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
- Header: a selector of the style configs found in your workspaces, Open (a config file), New (back to the two samples), New icon (the icon dialog) and Save (the config; a star marks unsaved edits).
- Left pane, Styles: the styles of the config, each with its background colour and its type. The header buttons add a style, duplicate or delete the selected one.
- Centre, Preview tab: one card per style, with one image per state of its type. Click a card to select the style.
- Centre, JSON tab: the whole config as text. An edit is applied as soon as it parses; an error is shown in the editor. Per-state overrides and per-corner radii are only editable here.
- Centre, Library tab: every style of the game and of the workspaces: a preview, the name, the widget class, the source (Vanilla or a workspace folder), the states and the imageset (green when found, red when missing). Filter by text, source or widget class. Click a row to copy the style name.
- Right pane, Style: name, type, radius and slice of the selected style, then its colours: Background, Border, Hover, Active, Focus, Checked, Fill and four accent bars (left, right, top, bottom). Each colour has a picker and a text field; empty means "none".
- Right pane, Generate: output name, texture path, scale (1×, 2×, 4×), the formats (PNG, EDDS, DZML CSS), the output folder and the Generate button. Warnings of the last generation are listed under the button.
First steps
- Open Style Studio. Two samples are there:
MyPanelandMyButton. - Click
MyButton. In the right pane, change Hover: the hover image of its card changes. - Rename it (for example
MyModButton): this is the name layouts will use. - In Generate, set Output name to a short name of your mod, for example
mymod. - Choose the Output folder: a folder inside your mod, for example
MyMod/gui/looknfeel. - Click Generate. The files are written and the Workbench reads its style list again.
- Click Save to keep the config as a JSON file, next to the generated files or anywhere in the mod.
- List the generated
.imagesetand.stylesin the mod'sconfig.cpp(see Concepts), then choose the style in the Layout Editor'sstyleproperty.
Take the tour (in the app)
Common tasks
Add a style for another widget type
- Click + in the Styles header.
- In the right pane, give it a name and choose its Type: panel, button, editbox, checkbox, slider or progressbar.
- 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.
- Check each state on its card.
Change one state only
- Open the JSON tab.
- In the style, add
"states": { "highlight": { "bg": "#262019" } }. The state keys arehighlight,pushed,focus,disabled,checkedandfill. - Go back to Preview to see it.
Find a style that already exists
- Open the Library tab.
- Choose the widget class (for example
ButtonWidget) and, if you want only the game's, the sourceVanilla. - Click the row of the style you like: its name is copied.
- Paste it in the
styleproperty of a widget in the Layout Editor, or indata-stylein DZML.
Regenerate after a change
- Open the config from the header selector or with Open. The output folder is set to the config's folder if it was empty.
- Change the colours.
- Click Generate, then Save. The file names do not change, so
config.cppstays as it is.
Draw an icon
- Click New icon.
- Choose a template and edit its glyph (SVG elements on a 24 × 24 grid), or choose "Custom SVG" and paste a whole SVG document.
- Check the preview at 32, 64 and 128 px on dark and light backgrounds.
- Give a name, the mod folder, optionally the imageset to add it to, and the size. Click Save icon.
- 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
- A complete UI kit (in the app): a config with one style of every type. Look at which colours each type uses and at the states on the cards. It is loaded in memory only.
- The styles of the game (in the app): the Library on the vanilla styles. See how many looks exist before drawing your own.
- Vanilla button styles (in the app): the same, for
ButtonWidgetonly.
Concepts
- Style: a named look for one widget class, with an image per state. A widget of a layout uses it with
style <Name>(data-style="<Name>"in DZML). Style names are looked up per widget class: a button style is not a panel style. - .styles: the file that declares styles: for each widget class, the style names and, per state, the image to draw. The game's own are in
gui/looknfeel/dayzwidgets.styles. Here the generated file is<output>_styles.styles. - Imageset: an
.imagesetfile cuts one texture (the atlas) into named rectangles. A layout refers to one asset:NAME image:IMG. Here the generated file is<output>_ui.imageset, and its texture path is the Texture path field: the path of the atlas as the game sees it (prefix of your mod + folder + file). - Atlas: the single texture holding every state of every style:
<output>_atlas.svg, plus.pngand.eddswhen ticked. EDDS is the format the game loads. - 9-slice: the image of a state is cut in nine parts: four corners kept at their size, four sides stretched in one direction, the centre stretched in both. A small image can so dress a widget of any size without deforming its corners. Slice is the size of the corners (0 to 3 atlas pixels, 3 by default); the radius cannot exceed it.
- States: a button has normal, hover and active; an edit box and a slider have normal, focus and disabled; a checkbox has normal, checked and disabled; a progress bar has normal, fill and disabled; a panel has normal and disabled.
- Registering in config.cpp: the game only loads the
.stylesand.imagesetfiles a mod lists inCfgMods> its class >class defs:class widgetStyles { files[] = {...}; };andclass imageSets { files[] = {...}; };, with in-game paths. - DZML CSS:
dzml-styles.cssgives the same looks to the browser preview of DZML pages. The game does not read it.
Pitfalls
- The style shows in the Workbench but not in the game: its files are not listed in
config.cpp. The Problems tab of the Layout Editor and theui_style_checktool report it. Unregistered, a style falls back to the default look and an image stays empty. - Texture path left at its default (
{GUID}<output>_atlas.edds): the imageset records this path for its atlas. Check that it matches where the atlas is in your mod (for exampleMyMod/gui/looknfeel/mymod_atlas.edds). - Renaming a style or the output name after layouts use it: layouts refer to styles by name and
config.cppto the files by name. Change both. - Generate does not save the config, and Save does not generate: they are two buttons. The config (JSON) is what you reopen later.
- Delete has no undo: a deleted style is gone unless you reopen the saved config.
- A slice out of range is clamped; the warning appears under Generate.
- The config changed on disk (the assistant, another editor): without local edits it is read again; with edits, a banner lets you choose.
For agents
Tools of dzt that do the same work without the window:
style_generate: from a config{output, texture, styles: [{name, type, bg, border, radius, hover, active, focus, checked, fill, left, right, top, bottom, states, slice}]}, write the atlas,<output>_ui.imageset,<output>_styles.stylesand the DZML CSS.style_preview: render one style of a config as a 9-sliced PNG at a given size and state.ui_style_check: check that every style used by the layouts of a mod is defined and that its.stylesand.imagesetare registered.icon_templates,icon_create: list the icon templates, then create an icon in a mod (EDDS, optionally in an imageset).icon_generate: the paid image-model variant.layout_render: see a layout that uses the styles as the game would draw it.vfs_readwithgui/looknfeel/dayzwidgets.styles: the game's own styles.
Files:
- Read: the config (a JSON file with a
stylesarray; the header selector lists those found in the workspaces), and for the Library every.stylesand.imagesetof the game and the workspaces. - Written: the config on Save; on Generate, into the output folder:
<output>_atlas.svg,<output>_atlas.pngand<output>_atlas.eddswhen ticked,<output>_ui.imageset,<output>_styles.styles, anddzml-styles.csswhen ticked. The icon dialog writes the icon files into the chosen mod folder.
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
- Layout Editor: use the styles and icons in a screen.
- How DZML works:
data-styleand the preview CSS. - Textures (PAA): look at an atlas or an icon texture.