diff --git a/src/components/AppBackground.vue b/src/components/AppBackground.vue index f0336c11..88edb2c7 100644 --- a/src/components/AppBackground.vue +++ b/src/components/AppBackground.vue @@ -2,11 +2,33 @@ import { useDark } from '~/composables/useDark' import { AppPage } from '~/enums/appEnums' import { settings } from '~/logic' +import { hexToHSL } from '~/utils/main' const props = defineProps<{ activatedPage: AppPage }>() const { isDark } = useDark() +const themeColorHsl = computed(() => { + return hexToHSL(settings.value.themeColor).replace('hsl(', '').replace(')', '') +}) +const themeColorHue = computed((): number => { + return Number(themeColorHsl.value.split(',')[0]) || 0 +}) +const themeColorSaturation = computed((): number => { + return Number(themeColorHsl.value.split(',')[1].replace('%', '')) || 0 +}) +const themeColorLightness = computed((): number => { + return Number(themeColorHsl.value.split(',')[2].replace('%', '')) || 0 +}) +const themeColorLinearGradientBackground = computed((): string => { + return `linear-gradient(180deg, + transparent 0% 38%, + hsl(${themeColorHue.value}, ${themeColorSaturation.value + 6}%, ${themeColorLightness.value * 0.42}%) 56%, + hsl(${themeColorHue.value}, ${themeColorSaturation.value}%, ${themeColorLightness.value}%) 76%, + hsl(${themeColorHue.value}, ${themeColorSaturation.value}%, ${themeColorLightness.value + 20}%) 90%, + hsl(${themeColorHue.value}, ${themeColorSaturation.value}%, 96%) 100%)` +}) + watch(() => settings.value.wallpaperMaskOpacity, () => { setAppWallpaperMaskingOpacity() }) @@ -37,36 +59,16 @@ function setAppWallpaperMaskingOpacity() {