mirror of
https://git.arson.gg/lilith/discord-bot.git
synced 2025-12-05 03:34:49 +01:00
9 lines
No EOL
355 B
JavaScript
9 lines
No EOL
355 B
JavaScript
// Set theme to the user's preferred color scheme
|
|
function updateTheme() {
|
|
const colorMode = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
document.querySelector("html").setAttribute("data-bs-theme", colorMode);
|
|
}
|
|
|
|
updateTheme()
|
|
|
|
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', updateTheme) |