encore.css holds every colour, typeface, size and curve an EndCore interface uses, plus the components built from them. Your own style.css only positions things. This page lists what is available.
<link rel="stylesheet" href="https://cfx-nui-en-ui/ui/encore.css">Tokens
All tokens are CSS custom properties on :root. Use them with var(--enc-...).
Surfaces and hairlines
| Token | Value | Use |
|---|---|---|
--enc-void | #060605 | Deepest black |
--enc-base | #0b0a08 | Solid backgrounds |
--enc-panel | #121009 | Default panel surface |
--enc-panel-2 | #1a170f | Raised surface |
--enc-panel-3 | #241f15 | Highest surface |
--enc-glass | rgba(11, 10, 8, 0.78) | Translucent surface for persistent overlays |
--enc-well | rgba(0, 0, 0, 0.35) | Recessed areas in overlays |
--enc-rule | rgba(154, 137, 102, 0.16) | Default 1px hairline |
--enc-rule-strong | rgba(196, 169, 112, 0.38) | Emphasised hairline |
Text
| Token | Value | Use |
|---|---|---|
--enc-text-hi | #fbf8f0 | Headings, focused values |
--enc-text | #e0dacc | Body text |
--enc-text-dim | #9a9180 | Labels, secondary text |
--enc-text-off | #5c5342 | Fine print, disabled |
--enc-legible | two-layer dark text shadow | Put on bare text in overlays so it reads over bright scenes |
Accent and danger
| Token | Value |
|---|---|
--enc-amber | #d9a441 |
--enc-amber-hot | #f0c368 |
--enc-amber-edge | rgba(217, 164, 65, 0.45) |
--enc-amber-wash | rgba(217, 164, 65, 0.10) |
--enc-oxide | #b33a2b |
--enc-oxide-hot | #d9584a |
--enc-oxide-flash | rgba(179, 58, 43, 0.55) |
--enc-oxide-wash | rgba(179, 58, 43, 0.12) |
Stats
| Token | Value |
|---|---|
--enc-health | #b8453a |
--enc-armor | #6d8ba8 |
--enc-hunger | #c98a3c |
--enc-thirst | #4d94a8 |
--enc-stamina | #8a9a4a |
--enc-radiation | #a8c23a |
--enc-infection | #8b5a9e |
--enc-immunity | #7a9440 |
--enc-cold | #5a8fa8 |
--enc-heat | #c4622f |
--enc-oxygen | #8fb8c9 |
Typefaces
| Token | Stack |
|---|---|
--enc-font-ui | Bahnschrift, then DIN Alternate, Franklin Gothic Medium, Segoe UI, system-ui, sans-serif |
--enc-font-mono | Consolas, then SF Mono, Roboto Mono, ui-monospace, monospace |
Type scale
| Token | Size |
|---|---|
--enc-t-micro | 0.66rem |
--enc-t-label | 0.72rem |
--enc-t-small | 0.82rem |
--enc-t-body | 0.95rem |
--enc-t-lead | 1.15rem |
--enc-t-h3 | 1.4rem |
--enc-t-h2 | 2rem |
--enc-t-h1 | clamp(2.4rem, 4vw, 3.6rem) |
--enc-t-display | clamp(3.5rem, 9vw, 8rem) |
Tracking
| Token | Value |
|---|---|
--enc-ls-label | 0.22em |
--enc-ls-display | 0.14em |
--enc-ls-ui | 0.06em |
--enc-ls-body | 0.012em |
Spacing
On a 4px grid at the default root size.
| Token | Value |
|---|---|
--enc-s1 | 0.25rem |
--enc-s2 | 0.5rem |
--enc-s3 | 0.75rem |
--enc-s4 | 1rem |
--enc-s5 | 1.5rem |
--enc-s6 | 2rem |
--enc-s7 | 3rem |
--enc-s8 | 4rem |
Easing and durations
| Token | Value | Use |
|---|---|---|
--enc-ease | cubic-bezier(0.22, 0.61, 0.36, 1) | State changes |
--enc-ease-in | cubic-bezier(0.55, 0.06, 0.68, 0.19) | Exits |
--enc-ease-hard | cubic-bezier(0.16, 1, 0.3, 1) | Entrances |
--enc-d-instant | 90ms | |
--enc-d-fast | 150ms | Hover |
--enc-d-base | 240ms | Transitions |
--enc-d-slow | 420ms | |
--enc-d-reveal | 650ms | Reveals |
Base styles
Loading encore.css also applies a reset suited to NUI:
box-sizing: border-boxand zero margins and padding on everything.htmlandbodyfill the screen and never scroll. Opt specific regions in with.enc-scroll.bodyis transparent, uses--enc-font-uiat--enc-t-body, and disables text selection.- Form controls inherit font, tracking and colour. Buttons have no background or border.
[hidden]and.enc-hiddenaredisplay: none !important.
Typography
| Class | What it is |
|---|---|
.enc-label | Stencil label: small, bold, uppercase, 0.22em tracking, dim. The workhorse for section headers, field names and button text |
.enc-label--accent | Label in amber |
.enc-micro | Fine print: micro size, uppercase, tracked, faint |
.enc-display | Huge condensed uppercase display type |
.enc-h1 | Condensed uppercase page heading |
.enc-h2 | Uppercase section heading |
.enc-h3 | Sub-heading |
.enc-dim | Dim text colour |
.enc-off | Faint text colour |
.enc-num | Consolas with tabular figures. Use it for every number |
.enc-rule-accent | Draws a short amber rule under the element |
<header>
<span class="enc-label enc-label--accent">Camp stash</span>
<h1 class="enc-h1 enc-rule-accent">North Ridge</h1>
<span class="enc-micro">Weight <span class="enc-num">42.5</span> / <span class="enc-num">80</span> kg</span>
</header>Panels and brackets
| Class | What it is |
|---|---|
.enc-panel | Surface with --enc-panel background and a 1px hairline border |
.enc-panel--raised | Uses --enc-panel-2 |
.enc-panel--solid | Uses --enc-base |
.enc-brackets | Amber corner marks at top-left and bottom-right, shown on hover or with .is-active |
<article class="enc-panel enc-brackets is-active">
<span class="enc-label">Selected</span>
<p>Hunting rifle</p>
</article>Buttons
| Class | What it is |
|---|---|
.enc-btn | Uppercase button with the clipped corner and a light sweep across it on hover |
.enc-btn--primary | Solid amber |
.enc-btn--danger | Oxide red; fills red on hover |
.enc-btn--ghost | Transparent with a faint border |
- Disabled buttons turn faint and lose the hover sweep.
- Keyboard focus is drawn as an inset amber ring, because the clipped corner would cut off an outline.
<button class="enc-btn enc-btn--primary">Take all <span class="enc-key">E</span></button>
<button class="enc-btn">Split</button>
<button class="enc-btn enc-btn--danger">Drop</button>
<button class="enc-btn enc-btn--ghost">Cancel <span class="enc-key">ESC</span></button>Keycaps
.enc-key is a small monospace keycap for hints like [E] or [ENTER], inside buttons or on its own. Inside a primary button it switches to dark ink.
Gauges
.enc-bar is a thin horizontal gauge with calibration ticks, used for survival stats and load progress.
| Class | What it is |
|---|---|
.enc-bar | The track, 4px tall |
.enc-bar--thick | 7px tall |
.enc-bar__fill | The fill. Set its width as a percentage. Amber with a glow by default |
.enc-bar__ticks | Tick overlay at every 10% |
.enc-bar--health, --hunger, --thirst, --radiation, --infection, --immunity | Stat-coloured fill |
<div class="enc-bar enc-bar--thick enc-bar--hunger">
<div class="enc-bar__fill" style="width: 64%"></div>
<div class="enc-bar__ticks"></div>
</div>The fill animates its width with --enc-d-slow and --enc-ease-hard. For bursty values such as load progress, drive it with Encore.progress, which never moves backwards.
Stat modifiers exist for the six stats above. For armour, stamina, oxygen, cold and heat, use the stat tokens.
Badges and status dots
| Class | What it is |
|---|---|
.enc-badge | Small uppercase tag in amber |
.enc-badge--danger | Oxide red |
.enc-badge--mute | Faint, no background |
.enc-dot | 6px status dot, faint by default |
.enc-dot--live | Amber, glowing and slowly pulsing |
<span class="enc-badge">Leader</span>
<span class="enc-badge enc-badge--danger">Infected</span>
<span class="enc-dot enc-dot--live"></span> <span class="enc-label">On radio</span>Form controls
Fields
.enc-field styles text inputs, selects and text areas.
- Focus brightens the background and turns the border amber.
- Number and date inputs use the monospace face with tabular figures and dark native pickers.
select.enc-fieldhas its native arrow removed. Wrap it and addEncore.icon('chevron')yourself.textarea.enc-fieldis at least 4.5rem tall and resizes vertically.
<label>
<span class="enc-label">Base name</span>
<input class="enc-field" type="text" maxlength="24" placeholder="North Ridge">
</label>Toggles
.enc-toggle is a rectangular switch with a sliding .enc-toggle__knob. Its state lives in aria-checked.
<button class="enc-toggle" role="switch" aria-checked="false" id="blip">
<span class="enc-toggle__knob"></span>
</button>const toggle = document.getElementById('blip');
toggle.addEventListener('click', () => {
const on = toggle.getAttribute('aria-checked') !== 'true';
toggle.setAttribute('aria-checked', String(on));
});Ranges
.enc-range styles a range input. Set the --fill custom property from script so the track shows the value.
<input class="enc-range" type="range" min="0" max="100" value="40" id="volume">const range = document.getElementById('volume');
const paint = () => range.style.setProperty('--fill', `${range.value}%`);
range.addEventListener('input', paint);
paint();Scroll regions
The page itself never scrolls. Give a list .enc-scroll to make it scroll vertically with a thin hairline scrollbar.
Modals
| Class | What it is |
|---|---|
.enc-scrim | Fixed full-screen backdrop that darkens and blurs the game, and centres its child |
.enc-dialog | Panel with an amber top edge that rises into place |
.enc-dialog--danger | Oxide red top edge, for destructive confirmations |
<div class="enc-scrim" id="confirm" hidden>
<div class="enc-dialog enc-dialog--danger" role="dialog" aria-modal="true" aria-labelledby="confirm-title">
<h2 class="enc-h3" id="confirm-title">Abandon base?</h2>
<p class="enc-dim">Everything stored here will be lost.</p>
<button class="enc-btn enc-btn--ghost" id="confirm-no">Keep it</button>
<button class="enc-btn enc-btn--danger" id="confirm-yes">Abandon</button>
</div>
</div>Trap focus inside an open dialog with Encore.trapFocus.
Persistent overlay root
Put class="enc-overlay" on the html element of always-on interfaces such as HUD pieces. The root font size then tracks screen height:
html.enc-overlay {
font-size: calc(clamp(11px, 1.4815vh, 26px) * var(--enc-overlay-scale, 1));
}That is 16px at 1080p, clamped between 11px and 26px. Size everything in rem and the overlay is the same physical size on any monitor. Set --enc-overlay-scale to let players resize the whole overlay.
Icons
.enc-icon styles the SVGs from Encore.icon(): 1.25em square, no fill, currentColor stroke at 1.75, square caps and mitred joins. Change an icon's colour by setting color on it or its parent. See Icons.
Motion classes
| Class | Animation |
|---|---|
.enc-anim-rise | Fades in while rising 14px, over --enc-d-reveal |
.enc-anim-slide | Fades in while sliding from the left, over --enc-d-base |
.enc-anim-wipe | Wipes in from left to right, over --enc-d-slow |
.enc-stagger | Delays the animation by --enc-i × 55ms. Set --enc-i with Encore.stagger(nodes) |
<ul id="roster">
<li class="enc-panel enc-anim-rise enc-stagger">...</li>
<li class="enc-panel enc-anim-rise enc-stagger">...</li>
</ul>Encore.stagger(document.querySelectorAll('#roster li'));All animation and transition durations collapse to almost nothing under prefers-reduced-motion: reduce.
Texture layers
.enc-grain, .enc-scanlines, .enc-vignette and .enc-haze are fixed, click-through layers. You don't write them by hand: Encore.mountTexture() injects them. See Texture.