DreamGUI
Plugin referenceLanguage

Presets

Four ready looks for .dui screens -- Default, Ember, Signal and Paper -- as libraries that declare the same colours, sizes and styles, so a project changes its whole look by changing one line; what every name is for.

Presets

DreamGUI ships four presets: libraries of colours, type sizes, spacing and styles that a screen wears instead of writing its own hex colours and pixel sizes. They are in the plugin's DUI/Presets/ folder. Each is a library -- resources and style blocks, no root node and no class line -- so it compiles into nothing on its own and writes no asset.

PresetLookAccent
DefaultGraphite greys, rounded cornerssoft blue
EmberWarm charcoal and parchment-coloured ink, small cornersamber
SignalBlue-black glass, tight cornersmint
PaperWarm off-white paper and dark ink (a light theme)vermilion

All four are low in saturation with one accent, have three steps of text colour and three of surface, and pass a 4.5 : 1 contrast for every text colour on every surface it is meant for. They declare the same names; only the values differ.

Naming the preset once

A project names its preset in one file, DUI/Theme.dui, which holds nothing but the use line. Every screen and every component takes the preset through it, under the namespace ui:

// DUI/Theme.dui
// The one line that picks the look of every screen and component in the project.
use "Plugin.DreamGUI:Presets/Default.dui"
use "Theme.dui" as ui

Changing Default to Ember, Signal or Paper in Theme.dui changes the look of every screen and component that uses it, at their next compile. A single screen can also name a preset directly, use "Plugin.DreamGUI:Presets/Ember.dui" as ui, but then its components keep the look their own use line gives them.

To make a preset of your own, copy one into your project's DUI/ folder (not DUI/Presets/, which would shadow the plugin's), change its values and keep its names, and point Theme.dui at it.

Using the names

  • Write Color = @ui.Ink, BodyColor = @ui.Surface, FontSize = @ui.SizeBody, Spacing = @ui.Gap4: never a hex colour or a raw size that a preset already has a name for. A screen that names only presets' values changes look with them.
  • Wear styles: Text : ui.Title, RectBlock : ui.Panel, Native.Button : ui.ButtonPrimary. A node's own lines win over its styles', so Text : ui.Caption { Color = @ui.Ink } is a caption in the main text colour.
  • Every size is in pixels at the 1920 x 1080 design size. Lay screens out on a design canvas that scales to the viewport (the building blocks start with one): at 1280 x 720 a 20 px body text is drawn at 13 px, as in a game.
  • A resource stands for a whole value. It cannot be one part of a tuple: Padding = (@ui.Gap4, 0, @ui.Gap4, 0) is DUI4003. Write the numbers, or set Spacing and the box's Padding from a style.

Colours

NameFor
BaseThe screen behind everything (ScreenBackdrop grades it)
SurfaceA panel's body
RaisedA card on a panel, a key cap, a secondary button
SunkenSunk into a panel: an empty slot, a well
Edge, EdgeStrongA panel's hairline edge and a divider; a stronger edge for what is framed
Ink, InkSoft, InkFaintText: what to read first, what supports it, what can be skipped
AccentThe one accent: the primary button, the selected tab's bar, a meter's fill
AccentSoftA weak fill of the accent: a selected row, a selected tab, a chip
AccentGlow, AccentEdgeThe accent see-through: a glow, the edge of a selected card
OnAccentText on the accent (the primary button's label)
Good, Bad, WarnStates: healed, gained, done; hurt, lost; running out
Common, Uncommon, Rare, Epic, LegendaryItem rarity
ScrimThe see-through plate under a HUD group, readable over any scene
ShadowThe shadow under a panel

Sizes

NameValue
SizeCaption, SizeBody, SizeLead, SizeTitle, SizeHeading, SizeDisplay16, 20, 24, 30, 44, 72
Gap1 to Gap84, 8, 12, 16, 24, 32, 48, 64
RadiusSmall, Radius, RadiusLargeThe preset's corners, in pixels (Signal's are the tightest)
EdgeWidthThe width of a hairline edge
FontRegular, FontBoldThe plugin's distance-field fonts

Styles

StyleWear it onFor
Display, Heading, TitleTextA screen's name; a page's heading; a panel's or card's title. Bold, Ink
Lead, Body, CaptionTextAn opening line; running text (InkSoft); small print (InkFaint)
OverlineTextA small spaced-out label in capitals over a group: SECTION, SLOT
FigureTextA number that is the point of its box: a level, a price
AccentText, GoodText, BadText, WarnTextTextText in the accent or a state colour
Label, LabelOnAccent, LabelQuietTextThe label inside a button, a tab or a key cap, centred
ScreenBackdropRectBlockWhat a full screen sits on: the base colour, lighter where the eye lands
PanelRectBlockA panel: graded body, hairline edge, rounded corners, a soft shadow
Card, CardSelectedRectBlockA card on a panel; the same card picked
WellRectBlockSunk into a panel: an empty slot, a frame for an icon
PlateRectBlockThe see-through plate under a HUD group
Chip, KeyCapRectBlockA small tag; a key prompt's cap
Divider, AccentBar, AccentFadeRectBlockA hairline; a short solid accent bar; the accent fading out to the right. No size of their own: give them @slot Size or a SizeDelta
GlowRectBlockA soft round light of the accent, behind a figure or an icon. Never over text
ButtonPrimary, ButtonSecondaryNative.ButtonThe one action a screen wants most; every other action
TabOn, TabOffNative.ButtonA selected tab; the others
Meter, MeterGood, MeterBad, MeterWarnNative.ProgressBarA meter in the accent or a state colour. Give it a height in its slot
FillParentany nodeAnchored to its parent's four corners: it fills the parent
FillSlotany node in a panelFills its slot both ways, with no size of its own

The control styles set StyleSource = Inline, so they take effect whether or not the project has a style sheet.

On this page