This commit is contained in:
Samidy 2025-10-02 13:01:02 +03:00
parent 59bed6bbe8
commit 3d65d9e84a
2 changed files with 92 additions and 0 deletions

View file

@ -54,6 +54,39 @@ const updateThemeColor = (colorName: ColorNames) => {
.map((scale) => `--vp-c-brand-${scale}: ${colorSet[scale]};`) .map((scale) => `--vp-c-brand-${scale}: ${colorSet[scale]};`)
.join('\n ') .join('\n ')
// if user isnt using halloween theme switch it
const nonHalloweenOverride = colorName !== 'halloween' ? `
--vp-c-bg: rgb(26, 26, 26) !important;
--vp-c-bg-alt: rgb(23, 23, 23) !important;
--vp-c-bg-elv: rgba(23, 23, 23, 0.8) !important;
--vp-button-alt-bg: #484848 !important;
--vp-button-alt-text: #f0eeee !important;
--vp-button-alt-hover-bg: #484848 !important;
--vp-button-alt-hover-text: #f0eeee !important;
--vp-button-brand-bg: var(--vp-c-brand-1) !important;
--vp-button-brand-border: var(--vp-c-brand-soft) !important;
--vp-button-brand-text: rgba(42, 40, 47) !important;
--vp-button-brand-hover-bg: var(--vp-c-brand-soft) !important;
--vp-button-brand-hover-border: var(--vp-c-brand-soft) !important;
--vp-button-brand-hover-text: rgba(42, 40, 47) !important;
` : ''
const nonHalloweenDarkOverride = colorName !== 'halloween' ? `
--vp-c-bg: rgb(26, 26, 26) !important;
--vp-c-bg-alt: rgb(23, 23, 23) !important;
--vp-c-bg-elv: rgba(23, 23, 23, 0.8) !important;
--vp-button-alt-bg: #484848 !important;
--vp-button-alt-text: #f0eeee !important;
--vp-button-alt-hover-bg: #484848 !important;
--vp-button-alt-hover-text: #f0eeee !important;
--vp-button-brand-bg: var(--vp-c-brand-1) !important;
--vp-button-brand-border: var(--vp-c-brand-soft) !important;
--vp-button-brand-text: rgba(42, 40, 47) !important;
--vp-button-brand-hover-bg: var(--vp-c-brand-soft) !important;
--vp-button-brand-hover-border: var(--vp-c-brand-soft) !important;
--vp-button-brand-hover-text: rgba(42, 40, 47) !important;
` : ''
css.value = ` css.value = `
:root { :root {
${cssVars} ${cssVars}
@ -61,6 +94,7 @@ const updateThemeColor = (colorName: ColorNames) => {
--vp-c-brand-2: ${colorSet[600]}; --vp-c-brand-2: ${colorSet[600]};
--vp-c-brand-3: ${colorSet[800]}; --vp-c-brand-3: ${colorSet[800]};
--vp-c-brand-soft: ${colorSet[400]}; --vp-c-brand-soft: ${colorSet[400]};
${nonHalloweenOverride}
} }
.dark { .dark {
@ -69,6 +103,7 @@ const updateThemeColor = (colorName: ColorNames) => {
--vp-c-brand-2: ${colorSet[500]}; --vp-c-brand-2: ${colorSet[500]};
--vp-c-brand-3: ${colorSet[700]}; --vp-c-brand-3: ${colorSet[700]};
--vp-c-brand-soft: ${colorSet[300]}; --vp-c-brand-soft: ${colorSet[300]};
${nonHalloweenDarkOverride}
} }
` `
@ -81,6 +116,12 @@ const updateThemeColor = (colorName: ColorNames) => {
} }
} }
// Set Halloween theme ASAP if its the pref
const storedTheme = localStorage.getItem('preferred-color')
if (!storedTheme || storedTheme === '"halloween"') {
document.documentElement.setAttribute('data-halloween-theme', 'true')
}
// Initialize theme color // Initialize theme color
updateThemeColor(selectedColor.value) updateThemeColor(selectedColor.value)

View file

@ -64,6 +64,57 @@
--vp-custom-block-halloween-text-deep: var(--halloween-900); --vp-custom-block-halloween-text-deep: var(--halloween-900);
} }
/* Apply halloween theme by default */
:root {
--vp-c-bg: rgb(20, 20, 20) !important;
--vp-c-bg-alt: rgb(18, 18, 18) !important;
--vp-c-bg-elv: rgba(18, 18, 18, 0.8) !important;
--vp-c-bg-soft: rgb(18, 18, 18) !important;
--vp-button-alt-bg: #a855f7 !important;
--vp-button-alt-text: #fff !important;
--vp-button-alt-hover-bg: #9333ea !important;
--vp-button-alt-hover-text: #fff !important;
--vp-button-brand-bg: #FF6A00 !important;
--vp-button-brand-border: #FF6A00 !important;
--vp-button-brand-text: #fff !important;
--vp-button-brand-hover-bg: #ea580c !important;
--vp-button-brand-hover-border: #ea580c !important;
--vp-button-brand-hover-text: #fff !important;
}
body {
background-color: rgb(20, 20, 20) !important;
}
.VPApp, .Layout, .VPContent, .VPHome, .VPHero, #app {
background-color: rgb(20, 20, 20) !important;
}
.dark {
--vp-c-bg: rgb(15, 15, 15) !important;
--vp-c-bg-alt: rgb(12, 12, 12) !important;
--vp-c-bg-elv: rgba(12, 12, 12, 0.8) !important;
--vp-c-bg-soft: rgb(12, 12, 12) !important;
--vp-button-alt-bg: #8b5cf6 !important;
--vp-button-alt-text: #e9d5ff !important;
--vp-button-alt-hover-bg: #a855f7 !important;
--vp-button-alt-hover-text: #fff !important;
--vp-button-brand-bg: #FF6A00 !important;
--vp-button-brand-border: #FF6A00 !important;
--vp-button-brand-text: #fff !important;
--vp-button-brand-hover-bg: #ea580c !important;
--vp-button-brand-hover-border: #ea580c !important;
--vp-button-brand-hover-text: #fff !important;
}
.dark body {
background-color: rgb(15, 15, 15) !important;
}
.dark .VPApp, .dark .Layout, .dark .VPContent, .dark .VPHome, .dark .VPHero, .dark #app {
background-color: rgb(15, 15, 15) !important;
}
.dark { .dark {
/* Colors: Brand */ /* Colors: Brand */
--vp-c-brand-1: theme('colors.swarm.400'); --vp-c-brand-1: theme('colors.swarm.400');