mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
refactor(theme): switch theme detection to use class
This commit is contained in:
@@ -24,6 +24,17 @@ export default function App() {
|
||||
<Links />
|
||||
</head>
|
||||
<body>
|
||||
<script
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `(() => {
|
||||
const prefersDarkMode = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
|
||||
const persistedColorPreference = localStorage.getItem('theme') || 'auto';
|
||||
if (persistedColorPreference === 'dark' || (prefersDarkMode && persistedColorPreference !== 'light')) {
|
||||
document.documentElement.classList.toggle('dark', true);
|
||||
}
|
||||
})();`,
|
||||
}}
|
||||
/>
|
||||
<Outlet />
|
||||
<ScrollRestoration />
|
||||
<Scripts />
|
||||
|
||||
@@ -8,9 +8,7 @@ export default defineConfig({
|
||||
},
|
||||
},
|
||||
presets: [
|
||||
presetUno({
|
||||
dark: 'media',
|
||||
}),
|
||||
presetUno({ dark: 'class' }),
|
||||
presetWebFonts({
|
||||
provider: 'google',
|
||||
fonts: {
|
||||
|
||||
Reference in New Issue
Block a user