You just redefine those variables under a [data-theme="dark"] selector every component flips automatically. Let me navigate this
[:root { --color-background-primary: #ffffff; --color-text-primary: #1a1a1a; }
[data-theme="dark"] { --color-background-primary: #121212; --color-text-primary: #f0f0f0; }]
2. Then have a Toggle button to switch between dark and light via JS Action
example
export async function ToggleDarkMode() {
const root = document.documentElement;
const isDark = root.getAttribute('data-theme') === 'dark';
root.setAttribute('data-theme', isDark ? 'light' : 'dark');
localStorage.setItem('theme', isDark ? 'light' : 'dark');
}
3. Restore on load by calling from App Layout nanoflow
export async function InitTheme() {
const saved = localStorage.getItem('theme') || 'light';
document.documentElement.setAttribute('data-theme', saved);
}
4. In your custom SCSS file have the color like the example below
example: ✅ background: var(--color-background-primary);
I hope this helps