3
submitted 1 year ago* (last edited 1 year ago) by Frellwit@lemmy.world to c/plugins@sh.itjust.works

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";
}
no comments (yet)
sorted by: hot top controversial new old
there doesn't seem to be anything here
this post was submitted on 06 Jul 2023
3 points (100.0% liked)

Lemmy Plugins and Userscripts

2 readers
1 users here now

A general repository for user scripts and plugins used to enhance the Lemmy browsing experience.

Post (or cross-post) your favorite Lemmy enhancements here!

General posting suggestions:

Thanks!

founded 1 year ago
MODERATORS