Skip to content

DocsGet startedTheme and accents

PT

Get started

Theme and accents

Light or dark and five leal labs accents, switched with two attributes on the html tag.

Change it here

These buttons change the whole documentation, the way your site would change. The choice is saved in this browser.

Deliveries this week
128 orders
+12%

Two attributes on the html tag

data-theme="dark" turns on dark mode. data-accent picks the accent: yellow, blue, green, gold or slate. Without them, you get light with yellow.

<html lang="pt-BR" data-theme="dark" data-accent="blue">

The accent shows up in accent buttons, highlights and the first series color of the charts. So no series repeats a color, the series that had the accent color turns yellow. The primary action is ink and doesn't change with the accent.

The attributes work on any element, not just html: a card with data-theme="dark" turns dark on its own. That's how the preview in these docs switches theme without touching the page.

No flash on load

Apply the saved theme before the first frame, in a synchronous script in the head, before the CSS. This is the one the site uses. In its own file, it passes a CSP with script-src 'self'.

(function (h) {
  var t = null, a = null;
  try { t = localStorage.getItem("u-theme"); a = localStorage.getItem("u-accent"); } catch (e) {}
  if (t === "dark" || (t !== "light" && matchMedia("(prefers-color-scheme: dark)").matches)) h.setAttribute("data-theme", "dark");
  if (a && /^(yellow|blue|green|gold|slate)$/.test(a)) h.setAttribute("data-accent", a);
})(document.documentElement);
<script src="/boot.js"></script>
<link rel="stylesheet" href="/unslop.css">

Your theme

Override the tokens in your CSS, after unslop.css. Components read everything through var(--*) and follow along. The full list is in Tokens.

:root {
  --accent: #E8590C;
  --accent-text: #A33F00;   "k-com">/* accent as text must pass 4.5:1 */
  --r-card: 20px;
  --r-panel: 8px;           "k-com">/* shell = inner + 12 of padding */
}

Type to search. Arrows pick, Enter opens.