The customizer
The palette button in the top bar opens the customizer panel. Every change applies at once, without reloading the page. The same options are on the Settings page, under Appearance.
| Option | Choices |
|---|---|
| Mode | Light, Dark or System. System follows the operating system’s setting, also when it changes while the page is open. The moon / sun button in the top bar switches between light and dark directly. |
| Theme | Selaras (teal & indigo, the default), Azure, Orchid, Ember and Graphite. Charts are redrawn in the new colors. |
| Sidebar color | Default, Tinted, Brand or Dark. Their colors come from the active theme. |
| Sidebar size | Expanded or Compact (icons only). Applies on screens 992 px and wider; on smaller screens the sidebar opens as a drawer. The button at the top of the sidebar toggles it too. |
| Reset to default | Back to Selaras, light mode, the Default sidebar color and an expanded sidebar. |
Pages without a sidebar — sign in, the error pages and the store — open the same panel without the two sidebar options.
Where the choices are saved
The customizer stores each choice in the browser’s localStorage, so it is remembered per browser and shared by the English and the Indonesian pages:
| Key | Values | Applied as |
|---|---|---|
sl-theme | selaras, azure, orchid, ember, graphite | data-sl-theme on <html> |
sl-mode | light, dark, system | data-sl-mode on <html> — always light or dark; System is resolved first |
sl-sidebar-color | default, tinted, brand, dark | data-sl-sidebar on <html> |
sl-collapsed | 1 or 0 | the sl-collapsed class on <html> |
If the browser blocks storage (some private windows do), the customizer still works for the current page; the choice is simply not remembered.
Applied before the page appears
A small inline script in src/partials/head.html reads the saved choices and sets the attributes on <html> before the stylesheets load. The page is therefore drawn in the right colors from the first frame — there is no flash of the light theme when dark mode is on.
If you move the pages into your own backend or framework, keep that script inline in the <head>, before the stylesheets. Loading it later, or from a separate file with defer, brings the flash back.
Color tokens
All colors in selaras.css come from CSS custom properties that start with --sl-. They have different values in light and dark mode and in each theme, so anything styled with them adapts automatically. The ones you will use most:
| Token | Used for |
|---|---|
--sl-canvas | The page background behind the cards. |
--sl-surface, --sl-surface-2 | Cards and panels; a slightly different surface for subtle fills. |
--sl-line, --sl-line-strong | Borders and dividers; a stronger border. |
--sl-ink, --sl-ink-2, --sl-ink-3 | Headings and strong text; body text; secondary text. |
--sl-primary | The theme’s brand color: charts, icons, the focus ring. |
--sl-primary-strong | Background of buttons with white text. |
--sl-primary-text | Links and accent text. |
--sl-primary-50, -100, -200 | Light tints of the brand color, from faint to stronger. |
--sl-secondary | The second theme color: the active menu item, the second chart series. |
--sl-data-3, --sl-data-4 | The third and fourth chart series. |
--sl-success, --sl-warning, --sl-danger, --sl-info | Status text colors, each with a light background to match, such as --sl-danger-50. |
--sl-r, --sl-r-lg, --sl-r-xl, --sl-r-sm | Corner radii. |
--sl-shadow-xs, --sl-shadow-md | Shadows. |
--sl-font | The font family. The font itself (Plus Jakarta Sans) is in assets/vendor/plus-jakarta-sans/ and is linked in src/partials/head.html. |
Bootstrap follows the same tokens: --bs-primary is set to --sl-primary-strong, and the body background, text and border colors point to --sl-canvas, --sl-ink-2 and --sl-line.
The Colors section of the component catalog shows the tokens with their values in the active theme and mode; click a swatch to copy it as var(--sl-…).
Change the brand colors
Each theme is defined by a few base colors at the top of assets/css/selaras.css; the tints and the sidebar colors are mixed from them. To give the template your brand colors, edit the block of the default theme, :root, [data-sl-theme="selaras"], and its dark-mode block further down:
| Base color | Role |
|---|---|
--sl-primary | The brand color. |
--sl-primary-strong | A darker shade for buttons — white text on it needs a contrast of at least 4.5:1. |
--sl-primary-hover | The button color on hover. In light mode it is also the color of links and accent text. |
--sl-rgb-strong | The same color as --sl-primary-strong, written as R, G, B numbers for Bootstrap’s --bs-primary-rgb. |
--sl-secondary | The second color. |
--sl-data-3, --sl-data-4 | The third and fourth chart colors. |
--sl-tint-a, --sl-tint-b | Pale backgrounds of the KPI cards in light mode (a = secondary family, b = primary family). |
--sl-side-brand | A dark background for the Brand sidebar style and the brand panel of the sign-in pages. |
In the dark-mode block, give --sl-primary, --sl-secondary and the data colors lighter values so they stay readable on dark backgrounds; the dark tints are calculated for you. Write every base color as a six-digit hex value (#RRGGBB): the charts and the contrast check read them in that form.
Then update the theme’s name and description in the THEMES list in build.mjs (the customizer shows “Teal & indigo · default”), rebuild, and run the contrast check.
Add your own theme
- In
assets/css/selaras.css, add a block with the base colors next to the other theme blocks, and a dark-mode block next to the other dark blocks. Use a name of lowercase letters only. - Add the theme to
THEMESinbuild.mjs. This adds its tile, with a small preview in its colors, to the customizer and to the Settings page. - Add the same name to the
THEMESlist inassets/js/selaras.js. Without it, choosing the tile falls back to the default theme. - Run
node build.mjs, thenpython tools/check-contrast.py.
/* assets/css/selaras.css — next to the other theme blocks */
[data-sl-theme="forest"] {
--sl-primary: #2E8540; --sl-primary-strong: #23733A; --sl-primary-hover: #1B5E2F;
--sl-secondary: #9C5B12;
--sl-data-3: #2E90FA; --sl-data-4: #E5B22E;
--sl-tint-a: #F6EEE3; --sl-tint-b: #E3F1E6;
--sl-side-brand: #16301F;
--sl-rgb-strong: 35, 115, 58;
}
/* next to the other dark blocks; the second selector colors the preview tile in dark mode */
[data-sl-mode="dark"][data-sl-theme="forest"], [data-sl-mode="dark"] [data-sl-theme="forest"] {
--sl-primary: #5CC274; --sl-primary-hover: #2E8540;
--sl-secondary: #E0A458; --sl-data-3: #62ADFB; --sl-data-4: #EFC556;
} const THEMES = [
{ key: 'selaras', name: 'Selaras', note: 'Teal & indigo · default' },
…
{ key: 'forest', name: 'Forest', note: 'Green & copper' },
]; var THEMES = ['selaras', 'azure', 'orchid', 'ember', 'graphite', 'forest']; The example colors above pass the contrast check in both modes. The theme’s name and description appear in English on the Indonesian pages until you add them to the dictionary.
Check the contrast
tools/check-contrast.py reads the theme colors straight from selaras.css and checks every important text and background pair against the WCAG AA contrast levels: 4.5:1 for text, 3:1 for icons and chart colors, and 7:1 for headings on the KPI tints. It covers every theme in light and dark mode, all four sidebar styles and the brand panel of the sign-in pages. It needs Python 3 and no extra packages:
python tools/check-contrast.py It prints one line per theme and mode (PASS or FAIL), lists each failing pair with its measured ratio, and exits with code 1 if anything fails, so it can also run in a build pipeline.
White text on buttons fails: darken --sl-primary-strong. Links or accent text fail in light mode: darken --sl-primary-hover. Text on the Brand sidebar or the sign-in panel fails: darken --sl-side-brand. A color fails in dark mode: make it lighter in the theme’s dark block.
Dark mode in your own components
Style your own components with the tokens instead of fixed colors, and they follow the theme and the mode without extra work. Give your classes your own prefix — sl- is reserved for the template.
.acme-panel {
background: var(--sl-surface);
border: 1px solid var(--sl-line);
border-radius: var(--sl-r-lg);
color: var(--sl-ink-2);
}
.acme-panel h3 { color: var(--sl-ink); }
.acme-panel .acme-tag { background: var(--sl-primary-50); color: var(--sl-primary-text); }
/* only for a value that must differ in dark mode */
[data-sl-mode="dark"] .acme-panel { box-shadow: none; } Code that reads colors in JavaScript — for a canvas, a map or a chart library — has to read them again when the theme or mode changes. Watch the two attributes on <html>:
var root = document.documentElement;
var paint = function () {
var primary = getComputedStyle(root).getPropertyValue('--sl-primary').trim();
// draw with the current color
};
paint();
new MutationObserver(paint).observe(root, { attributes: true, attributeFilter: ['data-sl-theme', 'data-sl-mode'] }); For ApexCharts on dashboard and app pages, use the chart helper from selaras.js. A chart drawn with window.slChart.draw() is redrawn automatically in the new colors; the function you pass returns the chart options and is called again on every change:
window.slChart.draw('#acmeChart', function () {
var C = window.slChart.colors(); // current theme colors
return window.slChart.merge(window.slChart.base(), {
chart: { type: 'area', height: 260 },
colors: [C.primary, C.secondary],
series: [{ name: 'Visits', data: [120, 180, 150, 220, 260] }],
xaxis: { categories: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'] }
});
}); Change the default theme
The defaults are what a visitor sees before choosing anything, and what Reset to default returns to. A choice that is already saved in the browser still wins, so clear the sl- keys from localStorage (or use Reset) to see a new default. To start with another theme, for example azure:
| File | What to change |
|---|---|
src/layout*.html | data-sl-theme="selaras" on the <html> tag of all four layouts. |
assets/js/selaras.js | The fallback 'selaras' in applyTheme and in the markTheme(…) call below it, and applyTheme('selaras') in the [data-theme-reset] handler. |
build.mjs | t.key === 'selaras' in themeHtml, so the right tile is marked before the script runs. |
To start in dark mode or follow the system, change the fallback 'light' in src/partials/head.html (localStorage.getItem('sl-mode') || 'light'), in modePref in selaras.js, and setMode('light') in the reset handler to 'dark' or 'system'. The sidebar color works the same way: data-sl-sidebar in the layouts, the 'default' fallbacks around setSidebarColor and setSidebarColor('default') in the reset handler.
Rebuild after changing the layouts, the partials or build.mjs.