@Tryt4n
Posted
You can also check if page's user have light or dark device color scheme.
if (!document.body.classList.contains("")) {
let dark = window.matchMedia("(prefers-color-scheme: dark)").matches;
if (dark == true) {
body.classList.remove("bg-white")
body.classList.add("bg-dark")
} else {
body.classList.remove("bg-dark")
body.classList.add("bg-white")
}
Marked as helpful
@htcsjs
Posted
@Tryt4n Thank you so much! I was not expecting someone to give feedback so fast lol, thanks for your comment i'm really happy! (◠‿◕). Update: i added it, now it should match the user's preference thank you once again!