From 0b49431daaf26a02b45ac694a95fbbdfae8141fb Mon Sep 17 00:00:00 2001 From: Doge Date: Tue, 11 May 2021 23:16:57 +0800 Subject: Add support for logo with dark mode and icon descriptions --- source/js/script.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'source/js/script.ts') diff --git a/source/js/script.ts b/source/js/script.ts index e6a2155..912c1d9 100644 --- a/source/js/script.ts +++ b/source/js/script.ts @@ -32,6 +32,19 @@ window.addEventListener("load", () => { }) } darklistener.add(colorman); + + // Add logo color selector + const logoman = (mode: SystemDarkmodePrefrence) => { + const logo = document.getElementById("logo"); + const darksrc = logo?.getAttribute("data-src-darkmode"); + const lightsrc = logo?.getAttribute("data-src-lightmode"); + if (!logo || !darksrc || !lightsrc) + return; + let src = (mode === SystemDarkmodePrefrence.dark) ? darksrc : lightsrc; + logo.setAttribute("src", src); + } + darklistener.add(logoman); + }); /* Darkmode listener */ -- cgit v1.2.3