[help] Is there a way to detect if a user is using one of the litely or darkly themes?
[help] Is there a way to detect if a user is using one of the litely or darkly themes?
I'm currently using const prefersDarkTheme = window.matchMedia('(prefers-color-scheme: dark)').matches;
but it doesn't take into consideration users that use a light system with a dark website.
EDIT: Solved with the following:
const element = document.getElementById("app");
const themeVariant = element.getAttribute("data-bs-theme");
if (themeVariant === "light") {
var primaryBackground = "#f0f0f0";
} else {
var primaryBackground = "#121317";
}
0 comments