mirror of
https://github.com/fmhy/edit.git
synced 2025-10-12 15:51:07 +11:00
misc fixes and improvments for halloween theme (#4127)
* halloween thingers * halloween thingers 2 * make halloween theme the preffered theme and change FMHY name gradient * background change for halloween * again * make background change on home page too * please let this work unc * change colors on home page button * let this work unc * fix some more issues * semi-final update (hopefully) * uhhuh * fixes for other themes besides halloween * light mode fixes (PLEASE let this work) * how did i not catch this omg * light mode fixes * add Halloween logo * Update image source from test.png to hall.png * add uwu logo * Change image for uwu * hall of the weens * background change when selecting another theme * make halloween emoji bigger + fixes * i hate this * please let this work unc
This commit is contained in:
parent
7f333ead3b
commit
333717cc27
1 changed files with 92 additions and 77 deletions
|
@ -3,7 +3,7 @@ import { colors } from '@fmhy/colors'
|
||||||
import { useStorage, useStyleTag } from '@vueuse/core'
|
import { useStorage, useStyleTag } from '@vueuse/core'
|
||||||
import { watch, onMounted } from 'vue'
|
import { watch, onMounted } from 'vue'
|
||||||
|
|
||||||
// Add Halloween colors locally
|
// Add Halloween colors
|
||||||
const halloweenColors = {
|
const halloweenColors = {
|
||||||
50: '#fff7ed',
|
50: '#fff7ed',
|
||||||
100: '#ffedd5',
|
100: '#ffedd5',
|
||||||
|
@ -18,7 +18,7 @@ const halloweenColors = {
|
||||||
950: '#431407'
|
950: '#431407'
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extend colors with Halloween theme
|
// hall extend or something
|
||||||
const extendedColors = {
|
const extendedColors = {
|
||||||
...colors,
|
...colors,
|
||||||
halloween: halloweenColors
|
halloween: halloweenColors
|
||||||
|
@ -54,53 +54,11 @@ 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 htmlElement = document.documentElement
|
||||||
const nonHalloweenOverride = colorName !== 'halloween' ? `
|
|
||||||
--vp-c-bg: #ffffff !important;
|
|
||||||
--vp-c-bg-alt: #f9f9f9 !important;
|
|
||||||
--vp-c-bg-elv: rgba(255, 255, 255, 0.7) !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' ? `
|
if (colorName === 'halloween') {
|
||||||
--vp-c-bg: rgb(26, 26, 26) !important;
|
// Apply Halloween theme
|
||||||
--vp-c-bg-alt: rgb(23, 23, 23) !important;
|
htmlElement.classList.add('theme-halloween')
|
||||||
--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 nonHalloweenBodyOverride = colorName !== 'halloween' ? `
|
|
||||||
body {
|
|
||||||
background-color: #ffffff !important;
|
|
||||||
}
|
|
||||||
.VPApp, .Layout, .VPContent, .VPHome, .VPHero, #app {
|
|
||||||
background-color: #ffffff !important;
|
|
||||||
}
|
|
||||||
.dark body {
|
|
||||||
background-color: rgb(26, 26, 26) !important;
|
|
||||||
}
|
|
||||||
.dark .VPApp, .dark .Layout, .dark .VPContent, .dark .VPHome, .dark .VPHero, .dark #app {
|
|
||||||
background-color: rgb(26, 26, 26) !important;
|
|
||||||
}
|
|
||||||
` : ''
|
|
||||||
|
|
||||||
css.value = `
|
css.value = `
|
||||||
:root {
|
:root {
|
||||||
|
@ -109,7 +67,6 @@ 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 {
|
||||||
|
@ -118,25 +75,76 @@ 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}
|
}
|
||||||
|
`
|
||||||
|
} else {
|
||||||
|
// Remove Halloween theme and apply other theme with normal backgrounds
|
||||||
|
htmlElement.classList.remove('theme-halloween')
|
||||||
|
|
||||||
|
css.value = `
|
||||||
|
:root {
|
||||||
|
${cssVars}
|
||||||
|
--vp-c-brand-1: ${colorSet[500]};
|
||||||
|
--vp-c-brand-2: ${colorSet[600]};
|
||||||
|
--vp-c-brand-3: ${colorSet[800]};
|
||||||
|
--vp-c-brand-soft: ${colorSet[400]};
|
||||||
|
--vp-c-bg: #ffffff !important;
|
||||||
|
--vp-c-bg-alt: #f9f9f9 !important;
|
||||||
|
--vp-c-bg-elv: rgba(255, 255, 255, 0.7) !important;
|
||||||
|
--vp-c-bg-soft: #f9f9f9 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
${nonHalloweenBodyOverride}
|
.dark {
|
||||||
`
|
${cssVars}
|
||||||
|
--vp-c-brand-1: ${colorSet[400]};
|
||||||
|
--vp-c-brand-2: ${colorSet[500]};
|
||||||
|
--vp-c-brand-3: ${colorSet[700]};
|
||||||
|
--vp-c-brand-soft: ${colorSet[300]};
|
||||||
|
--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-c-bg-soft: rgb(23, 23, 23) !important;
|
||||||
|
}
|
||||||
|
|
||||||
// Add/remove Halloween theme indicator
|
html, body {
|
||||||
const htmlElement = document.documentElement
|
background-color: #ffffff !important;
|
||||||
if (colorName === 'halloween') {
|
}
|
||||||
htmlElement.setAttribute('data-halloween-theme', 'true')
|
|
||||||
} else {
|
.VPApp, .Layout, .VPContent, .VPHome, .VPHero, #app, .vp-doc {
|
||||||
htmlElement.removeAttribute('data-halloween-theme')
|
background-color: #ffffff !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.VPHome {
|
||||||
|
background-color: #ffffff !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.VPHome .VPHero {
|
||||||
|
background-color: #ffffff !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dark html, .dark body {
|
||||||
|
background-color: rgb(26, 26, 26) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dark .VPApp, .dark .Layout, .dark .VPContent, .dark .VPHome, .dark .VPHero, .dark #app, .dark .vp-doc {
|
||||||
|
background-color: rgb(26, 26, 26) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dark .VPHome {
|
||||||
|
background-color: rgb(26, 26, 26) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dark .VPHome .VPHero {
|
||||||
|
background-color: rgb(26, 26, 26) !important;
|
||||||
|
}
|
||||||
|
`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set Halloween theme ASAP if its the pref
|
// Set Halloween theme ASAP if its the pref
|
||||||
const storedTheme = localStorage.getItem('preferred-color')
|
const storedTheme = localStorage.getItem('preferred-color')
|
||||||
if (!storedTheme || storedTheme === '"halloween"') {
|
if (!storedTheme || storedTheme === '"halloween"') {
|
||||||
document.documentElement.setAttribute('data-halloween-theme', 'true')
|
document.documentElement.classList.add('theme-halloween')
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize theme color
|
// Initialize theme color
|
||||||
|
@ -145,7 +153,7 @@ updateThemeColor(selectedColor.value)
|
||||||
// halloween stuff
|
// halloween stuff
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (selectedColor.value === 'halloween') {
|
if (selectedColor.value === 'halloween') {
|
||||||
document.documentElement.setAttribute('data-halloween-theme', 'true')
|
document.documentElement.classList.add('theme-halloween')
|
||||||
}
|
}
|
||||||
// Re-apply the theme to ensure everything is initialized
|
// Re-apply the theme to ensure everything is initialized
|
||||||
updateThemeColor(selectedColor.value)
|
updateThemeColor(selectedColor.value)
|
||||||
|
@ -170,6 +178,13 @@ const normalizeColorName = (colorName: string) =>
|
||||||
:title="normalizeColorName(color)"
|
:title="normalizeColorName(color)"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
|
v-if="color === 'halloween'"
|
||||||
|
class="inline-block w-6 h-6 flex items-center justify-center text-xl"
|
||||||
|
>
|
||||||
|
🎃
|
||||||
|
</span>
|
||||||
|
<span
|
||||||
|
v-else
|
||||||
class="inline-block w-6 h-6 rounded-full"
|
class="inline-block w-6 h-6 rounded-full"
|
||||||
:style="{ backgroundColor: extendedColors[color][500] }"
|
:style="{ backgroundColor: extendedColors[color][500] }"
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue