Greasy Fork is available in English.

Auto Dark Mode for Bahamut AniMad

Automatically switch the theme between light and dark, based on the browser’s color scheme preference.

// ==UserScript==
// @name               Auto Dark Mode for Bahamut AniMad
// @name:zh-TW         巴哈姆特動畫瘋自動黑暗模式
// @description        Automatically switch the theme between light and dark, based on the browser’s color scheme preference.
// @description:zh-TW  根據瀏覽器的佈景主題設定,自動從明亮和黑暗模式間切換。
// @icon               data:image/webp;base64,UklGRnIGAABXRUJQVlA4IGYGAAAQJACdASqQAJAAPtFgq08oJaQjKRZJyQAaCWIAyQkF1ckHPnn7vRb/lN2bzrPox3lj0JfOu/8vtBf5vJOcFaWuCGZXwp+wWwb4kSvAx0Stzc/nhJy1R+DmnYyGUE5MUW5CTcSPgmEoHm5PNAswIWJqRvZcCsqM09J40EvQ3+KbIBUcRNyNoGIjaRtT2IBuSIq84MhK8qyb1BHXapW7qGN3yukKcVzx5eHhstVndRw9UXA4o3plAht9vHztfXsixnFh+YUQmUxga9qKoVUQnPGF0IYbaZs9l1j/hzHlOR9UQapayFu4BMKtMYGwpCnlySRf4vXabKrlVNQrdBtr6YdzQ2yzPYJW3snJVL+dE4olMjCKaJaJF9EaUdWqAovIVf0dk+EV3S8rYTgA/vOHfjlvU/nYGpVr22WF+MgTnueJhRdeHjOiWiXtcb9xRJjsPpPQazgy626q204miS3XN0OVQ2tZZ9ocpyMPkHOQB8AyCVyach11k77FS9ayU2HzveJmun4Ajw6e8eGOd2pxgfuVVPcncLVX0ezEyXyh1S3DkNhYmOTUCRh/eYc2jWvZ8Yx/JGYtO3sB21dUJUCTIFLhEgL+LO1m6lHVQijQuEGmiViIKjWVDVOg7i6tI2W3JSaM1LSVTTXsSgszRtR+0Cpl3Jtz84AIJOQf8C+gFOBEDYt23WLtj/N+56TvFfHsODtSQCZMjxzIEVnEK0UUyxHz7hkjhtzgkO6fIXQCLhZdaows67Z3YvM/24CYTvOLAXv6l0I/kHXGcmK/V+Zpi4Oi2/QkZuxO9irjh/UWdBwhlEm0RcTk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yoAIPR0n/1NMgXKnpvNEybiAc1Nj6KQ8DJJ/OZV2FMH//xBJnNK1pOoNoQG6/1v3E4oOXlixvHCLeHPNq2bPqwzn3woNpwA/8B89Wnm1fFc/AUjR93HbazWcYlqjdWa1QyOdkqUoir8ebMuoscHryVxXuGd/nBj8VqqxMXy49y6ZLkDF7QpVx7Bh/Fp4EkUGGv9otl+SNPOYprnrl5IiSEV8vkfEVvW+r/6HI+Xy4N3m3bTuK479C4VGVFDg++01OmIS7gCP2JSFjMO+FDTU2FoAc5VResCSAAAAA=
// @author             Jason Kwok
// @namespace          https://jasonhk.dev/
// @version            1.0.6
// @license            MIT
// @match              https://ani.gamer.com.tw/*
// @run-at             document-idle
// @grant              none
// @supportURL         https://greasyfork.org/scripts/447811/feedback
// ==/UserScript==

const toggle = document.getElementById("lightSwitch");
const query = matchMedia("(prefers-color-scheme: dark)");

query.addEventListener("change", updateTheme);
updateTheme(query);

function updateTheme({ matches: isDarkMode })
{
    if (toggle.checked !== isDarkMode)
    {
        toggle.click();
    }
}