im just doing shit atp

This commit is contained in:
Samidy 2025-11-01 13:47:32 +03:00 committed by GitHub
parent 053714b9ce
commit f99ce02782
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2,6 +2,7 @@
import { colors } from '@fmhy/colors'
import { useStorage, useStyleTag } from '@vueuse/core'
import { watch } from 'vue'
import Switch from './Switch.vue'
const colorScales = [
'50',
@ -19,6 +20,7 @@ const colorScales = [
type ColorNames = keyof typeof colors
const selectedColor = useStorage<ColorNames>('preferred-color', 'swarm')
const isAmoledMode = useStorage('amoled-mode', false)
const colorOptions = Object.keys(colors).filter(
(key) => typeof colors[key as keyof typeof colors] === 'object'
@ -26,7 +28,7 @@ const colorOptions = Object.keys(colors).filter(
const { css } = useStyleTag('', { id: 'brand-color' })
const updateThemeColor = (colorName: ColorNames) => {
const updateThemeColor = (colorName: ColorNames, amoledEnabled: boolean) => {
const colorSet = colors[colorName]
const cssVars = colorScales
@ -52,10 +54,35 @@ const updateThemeColor = (colorName: ColorNames) => {
`
}
if (amoledEnabled) {
htmlElement.classList.add('theme-amoled')
} else {
htmlElement.classList.remove('theme-amoled')
}
// Determine dark background color based on AMOLED mode
const darkBg = amoledEnabled ? '#000000' : 'rgb(26, 26, 26)'
const darkBgAlt = amoledEnabled ? '#000000' : 'rgb(23, 23, 23)'
const darkBgElv = amoledEnabled ? 'rgba(0, 0, 0, 0.9)' : 'rgba(23, 23, 23, 0.8)'
const darkBgSoft = amoledEnabled ? '#000000' : 'rgb(23, 23, 23)'
if (typeof window !== 'undefined') {
const storedTheme = localStorage.getItem('preferred-color')
const storedAmoled = localStorage.getItem('amoled-mode')
if (storedAmoled === 'true') {
document.documentElement.classList.add('theme-amoled')
}
}
// Initialize theme color
updateThemeColor(selectedColor.value)
watch(selectedColor, updateThemeColor)
watch(selectedColor, updateThemeColorm, isAmoledMode.value)
const normalizeColorName = (colorName: string) =>
colorName.replaceAll(/-/g, ' ').charAt(0).toUpperCase() +
@ -83,6 +110,10 @@ const normalizeColorName = (colorName: string) =>
<div class="mt-2 text-sm text-$vp-c-text-2">
Selected: {{ normalizeColorName(selectedColor) }}
</div>
<div class="mt-4 flex items-center gap-2">
<span class="text-sm text-$vp-c-text-2">AMOLED</span>
<Switch @click="isAmoledMode = !isAmoledMode" />
</div>
</div>
</template>