mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 22:00:31 +00:00
feat: theme preloading and dark mode
This commit is contained in:
16
packages/webapp/public/preload-theme.js
Normal file
16
packages/webapp/public/preload-theme.js
Normal file
@@ -0,0 +1,16 @@
|
||||
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');
|
||||
}
|
||||
Reference in New Issue
Block a user