mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 11:33:30 +01:00
refactor(theme): switch theme detection to use class
This commit is contained in:
@@ -24,6 +24,17 @@ export default function App() {
|
|||||||
<Links />
|
<Links />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<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 />
|
<Outlet />
|
||||||
<ScrollRestoration />
|
<ScrollRestoration />
|
||||||
<Scripts />
|
<Scripts />
|
||||||
|
|||||||
@@ -8,9 +8,7 @@ export default defineConfig({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
presets: [
|
presets: [
|
||||||
presetUno({
|
presetUno({ dark: 'class' }),
|
||||||
dark: 'media',
|
|
||||||
}),
|
|
||||||
presetWebFonts({
|
presetWebFonts({
|
||||||
provider: 'google',
|
provider: 'google',
|
||||||
fonts: {
|
fonts: {
|
||||||
|
|||||||
Reference in New Issue
Block a user