Styling¶
Use custom properties to switch a screen between colour sets, and transitions and animations to fade it or draw the eye to a changed value.
A document links each style sheet (.rcss) with <link type="text/rcss" href="..."/> in its head
(Documents). What CSS is supported is in CSS support; what differs from a
browser is in Coming from HTML and CSS, and Tailwind classes in Tailwind CSS. This page
covers themes and animation.
Two samples show the style features a screen uses most. Themes switches colour sets with custom properties, and Animations
fades a screen in and out and flashes a value when it changes. Run them by choosing Themes and
Animations in the samples list in the map L_ArcRmlSamples (Samples).
Themes¶
The colours are custom properties on :root. A class on body declares them again, and every element below the body reads
the new values through var(), so no other rule changes.

:root {
--panel: #2c3a52;
--text: #e8e8e8;
--accent: #2f6fb0;
--button: #3a4456;
}
body.theme-dark {
--panel: #0c0e14;
--text: #b8c0d0;
--accent: #7a4fd0;
--button: #1c212c;
}
<body :model="themes" class:theme-dark="themes.Theme == 'dark'" class:theme-contrast="themes.Theme == 'contrast'">
<button id="th-dark" class="th-button" on:click="call('themes', 'SetTheme', 'dark')">Dark</button>
SetTheme is a function of the sample's view model; the button's call runs it:
void UArcRmlSamplesThemesViewModel::SetTheme(const FString& Name)
{
UE_MVVM_SET_PROPERTY_VALUE(Theme, Name);
}
class:theme-dark="Theme == 'dark'": the class is on while the expression is true. The default theme has no class.class:theme-contrast="Theme == 'contrast'"does the same for the High contrast button, withbody.theme-contrastdeclared inThemes.rcss.var(--muted, #9aa6ba)uses#9aa6bawhen--mutedhas no value; the sample gives it a value only inbody.theme-contrast. Avar()with no fallback and no value makes the property invalid, so it takes its inherited or initial value.@propertygives a custom property a type and an initial value; the sample does not use it.
Enter and leave¶
The host puts the class enter on body when the document is shown and leave when it closes. A rule on body.enter or
body.leave starts the animation.
body.enter {
animation: an-enter 0.4s linear forwards;
}
body.leave {
animation: an-leave 0.3s linear forwards;
}
- The leave ends when the body's animation or transition ends, at the latest after Leave Timeout Seconds
(default 0.5 s, Project Settings > Game > ArcRmlUI > Transitions); then the document is removed. A leave animation longer than that is cut
off.
forwardsholds the last frame until the document goes. - To see why a leave ended early, run
log LogArcRmlUI Verbosein the console (Open the console). The log then showsleave started (timeout <s> s)andleave finished by <reason> after <ms> ms. @starting-styleis not supported: its rules are dropped. Use a@keyframesanimation onbody.enterfor an entrance.
Pulse¶
pulse:<class>="Expr" adds the class to the element each time the value changes, so an animation that the class
starts runs again.
<p id="an-hits" class="an-hits" pulse:flash="animations.Hits">Hits: {{ animations.Hits }}</p>
.an-hits.flash {
animation: an-flash 0.6s linear forwards;
}
Each change of Hits removes the class flash and adds it back in the same UI update, and the class stays until the next change.
The <class> is the part of the attribute name after pulse:.
Limits
- The first value never pulses, and several changes before one UI update give one pulse.
- A view created in the update that changes the value (a
:ifbranch, a new row) does not pulse. - An unkeyed
:forrow reads whichever item sits at its index, so an insert or a removal pulses it. Put pulses in keyed rows (Data binding).