Update theme handling and add theme selection dropdown in Navbar.svelte

This commit is contained in:
Sean Morley
2024-04-17 00:15:27 +00:00
parent b76e655e38
commit 5efb2912c0
5 changed files with 11 additions and 7 deletions

View File

@@ -30,7 +30,8 @@ export const actions: Actions = {
},
setTheme: async ( { url, cookies }) => {
const theme = url.searchParams.get("theme");
if (theme) {
// change the theme only if it is one of the allowed themes
if (theme && ["light", "dark", "night", "retro", "forest"].includes(theme)) {
cookies.set("colortheme", theme, {
path: "/",
maxAge: 60 * 60 * 24 * 365,

View File

@@ -55,7 +55,7 @@
</div>
{#if errors.message}
<div class="text-center text-red-500 mt-4">
<div class="text-center text-error mt-4">
{errors.message}
</div>
{/if}