Files
bigcapital/packages/webapp/public/preload-theme.js
2025-11-26 21:27:42 +02:00

17 lines
469 B
JavaScript

const theme =
localStorage.getItem('theme') ||
(window.matchMedia('(prefers-color-scheme: dark)').matches
? 'dark'
: 'light');
if (theme === 'dark') {
document.documentElement.classList.add('bp4-dark');
document.body.classList.add('bp4-dark');
}
// Remove dark mode for payment portal pages
if (window.location.pathname.startsWith('/payment')) {
document.documentElement.classList.remove('bp4-dark');
document.body.classList.remove('bp4-dark');
}