summaryrefslogtreecommitdiffstats
path: root/static/theme-init.js
diff options
context:
space:
mode:
authorGab Virebent <gabriel1@virebent.art>2026-07-02 03:58:31 +0200
committerGab Virebent <gabriel1@virebent.art>2026-07-02 03:58:31 +0200
commitf615473c408a76eb59bf98a3022c9998bea3bc7e (patch)
treecba683633251536c1c39d6249148d727ee479ea0 /static/theme-init.js
parent487adbaab5b1227a9a15ae7b3d4116c93ffde4ba (diff)
downloadnymdrop-f615473c408a76eb59bf98a3022c9998bea3bc7e.tar.gz
nymdrop-f615473c408a76eb59bf98a3022c9998bea3bc7e.tar.xz
nymdrop-f615473c408a76eb59bf98a3022c9998bea3bc7e.zip
Add light/dark theme toggle, fix dark theme text contrast
Theme state persists via localStorage, applied pre-paint by theme-init.js to avoid flash. All JS moved to external files (app.js, theme-init.js) to keep script-src 'self' CSP intact, no inline scripts. Dark theme footer/notice/tagline colors were too close to the background (footer nearly matched the card border color) and hard to read; brightened to readable grays while leaving the light theme and submit button untouched.
Diffstat (limited to 'static/theme-init.js')
-rw-r--r--static/theme-init.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/static/theme-init.js b/static/theme-init.js
new file mode 100644
index 0000000..95b9a95
--- /dev/null
+++ b/static/theme-init.js
@@ -0,0 +1,5 @@
+(function() {
+ if (localStorage.getItem('nymdrop-theme') === 'light') {
+ document.documentElement.setAttribute('data-theme', 'light');
+ }
+})();