From 96fef514a25b16e001b7bb715aa354dc53d6eb64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20P=C4=99dzich?= Date: Sat, 21 Jan 2023 23:57:39 +0100 Subject: [PATCH] Ensure custom theme prefs are saved --- src/layouts/BaseLayout.astro | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/layouts/BaseLayout.astro b/src/layouts/BaseLayout.astro index a87538f..e72994c 100644 --- a/src/layouts/BaseLayout.astro +++ b/src/layouts/BaseLayout.astro @@ -60,6 +60,11 @@ const metaTagTitle = `${title} - Spotify Playlist Archive`; } else { document.documentElement.setAttribute('data-theme', 'dark'); } + + localStorage.setItem( + 'theme', + document.documentElement.getAttribute('data-theme') + ); };