From fc5aedcedd799c4770dbb2706d7f092a7ddfa49a Mon Sep 17 00:00:00 2001 From: Zoe <62722391+juls0730@users.noreply.github.com> Date: Tue, 24 Feb 2026 16:35:40 +0000 Subject: [PATCH] reafctor: Rely only on the database for themes This commit makes it so that a user's theme will only be pulled from the database rather than from a weird mix of cookies and the database. This fixes some issues with themes rendering weirdly. --- app/app.vue | 31 ++------ app/assets/css/base.css | 2 +- app/components/ChatInput.vue | 2 +- .../Settings/AppearanceSettings.vue | 3 +- app/composables/useTheme.ts | 76 ------------------- app/composables/useUserSettings.ts | 72 ++++++++++++++++-- app/layouts/default.vue | 3 +- 7 files changed, 75 insertions(+), 114 deletions(-) delete mode 100644 app/composables/useTheme.ts diff --git a/app/app.vue b/app/app.vue index 1fa4810..6cb0318 100644 --- a/app/app.vue +++ b/app/app.vue @@ -2,14 +2,15 @@ import '~/assets/css/reset.css'; import '~/assets/css/base.css'; -const { accent, neutral, hinting } = useTheme(); +const { accent, neutral, hinting } = await useUserSettings(); // by default, disable hinting if (Number.isNaN(Number(hinting.value))) hinting.value = '0'; -useHead({ - htmlAttrs: { - style: ` +watchEffect(() => { + useHead({ + htmlAttrs: { + style: ` --neutral-100: var(--palette-${neutral.value}-100); --neutral-200: var(--palette-${neutral.value}-200); --neutral-300: var(--palette-${neutral.value}-300); @@ -17,31 +18,13 @@ useHead({ --color-accent-hover: var(--accent-${accent.value}-hover, var(--accent-violet-hover)); --accent-hinting: ${hinting.value}%; --base-hinting: calc(100% - var(--accent-hinting));`, - }, + }, + }); }); if (import.meta.client) { // force shiki into browser rendering only window.sessionStorage.setItem('mdc-shiki-highlighter', 'browser'); - - watchEffect(() => { - document.documentElement.style.setProperty( - '--color-accent', - `var(--accent-${accent.value}, var(--accent-violet))`, - ); - document.documentElement.style.setProperty( - '--color-accent-hover', - `var(--accent-${accent.value}-hover, var(--accent-violet-hover))`, - ); - // document.documentElement.style.setProperty( - // '--color-neutral', - // `var(--neutral-${neutral.value}, var(--neutral-zinc))`, - // ); - document.documentElement.style.setProperty('--neutral-100', `var(--palette-${neutral.value}-100)`); - document.documentElement.style.setProperty('--neutral-200', `var(--palette-${neutral.value}-200)`); - document.documentElement.style.setProperty('--neutral-300', `var(--palette-${neutral.value}-300)`); - document.documentElement.style.setProperty('--accent-hinting', `${hinting.value}%`); - }); } diff --git a/app/assets/css/base.css b/app/assets/css/base.css index 88d0bbf..cd0431a 100644 --- a/app/assets/css/base.css +++ b/app/assets/css/base.css @@ -1,7 +1,7 @@ :root { --spacing: 0.25rem; - --color-accent-text: #232625; + --color-accent-text: #fcfdff; --reasoning-accent: #a62bcb; diff --git a/app/components/ChatInput.vue b/app/components/ChatInput.vue index a17736e..5374771 100644 --- a/app/components/ChatInput.vue +++ b/app/components/ChatInput.vue @@ -161,7 +161,7 @@ onUnmounted(() => {