Commit 1ab03abafe
Unsigned
Layout: unified · split
docs/.vitepress/theme/Layout.vue +22 −7
| @@ -572,7 +572,10 @@ watchEffect(() => { | ||
| 572 | 572 | ) |
| 573 | 573 | }) |
| 574 | 574 | |
| 575 | const accentPalettes: Record<string, Record<string, string>> = { | |
| 575 | type ShadeMap = Record<string, string> | |
| 576 | type PaletteEntry = ShadeMap | { dark: ShadeMap; light: ShadeMap } | |
| 577 | ||
| 578 | const accentPalettes: Record<string, PaletteEntry> = { | |
| 576 | 579 | ayanami: { |
| 577 | 580 | 400: 'oklch(0.722 0.105 247.48)', |
| 578 | 581 | 500: 'oklch(0.626 0.098 247.46)', |
| @@ -616,11 +619,20 @@ const accentPalettes: Record<string, Record<string, string>> = { | ||
| 616 | 619 | 800: 'oklch(0.461 0.176 28.95)', |
| 617 | 620 | }, |
| 618 | 621 | fubuki: { |
| 619 | 400: 'oklch(0.82 0 0)', | |
| 620 | 500: 'oklch(0.72 0 0)', | |
| 621 | 600: 'oklch(0.62 0 0)', | |
| 622 | 700: 'oklch(0.52 0 0)', | |
| 623 | 800: 'oklch(0.42 0 0)', | |
| 622 | dark: { | |
| 623 | 400: 'oklch(0.82 0 0)', | |
| 624 | 500: 'oklch(0.72 0 0)', | |
| 625 | 600: 'oklch(0.62 0 0)', | |
| 626 | 700: 'oklch(0.52 0 0)', | |
| 627 | 800: 'oklch(0.42 0 0)', | |
| 628 | }, | |
| 629 | light: { | |
| 630 | 400: 'oklch(0.58 0 0)', | |
| 631 | 500: 'oklch(0.48 0 0)', | |
| 632 | 600: 'oklch(0.38 0 0)', | |
| 633 | 700: 'oklch(0.28 0 0)', | |
| 634 | 800: 'oklch(0.18 0 0)', | |
| 635 | }, | |
| 624 | 636 | }, |
| 625 | 637 | } |
| 626 | 638 | |
| @@ -628,7 +640,10 @@ const accentColor = useStorage(AccentColorStorageKey, 'ayanami') | ||
| 628 | 640 | |
| 629 | 641 | watchEffect(() => { |
| 630 | 642 | if (import.meta.env.SSR) return |
| 631 | const shades = accentPalettes[accentColor.value] ?? accentPalettes.ayanami | |
| 643 | const palette = accentPalettes[accentColor.value] ?? accentPalettes.ayanami | |
| 644 | const shades = 'dark' in palette | |
| 645 | ? (isDark.value ? palette.dark : palette.light) | |
| 646 | : palette | |
| 632 | 647 | const el = document.documentElement |
| 633 | 648 | if (isDark.value) { |
| 634 | 649 | el.style.setProperty('--vp-c-brand-1', shades['400']) |
docs/.vitepress/theme/components/settings/AccentColor.vue +6 −2
| @@ -1,9 +1,12 @@ | ||
| 1 | 1 | <script setup lang="ts"> |
| 2 | import { useData } from 'vitepress' | |
| 2 | 3 | import { useStorage } from '@vueuse/core' |
| 3 | 4 | |
| 4 | 5 | import { AccentColorStorageKey } from '../../constants' |
| 5 | 6 | import MenuTitle from './MenuTitle.vue' |
| 6 | 7 | |
| 8 | const { isDark } = useData() | |
| 9 | ||
| 7 | 10 | const accentOptions = [ |
| 8 | 11 | { |
| 9 | 12 | key: 'ayanami', |
| @@ -39,8 +42,9 @@ const accentOptions = [ | ||
| 39 | 42 | key: 'fubuki', |
| 40 | 43 | label: 'Fubuki', |
| 41 | 44 | shades: ['oklch(0.82 0 0)', 'oklch(0.72 0 0)', 'oklch(0.62 0 0)', 'oklch(0.52 0 0)', 'oklch(0.42 0 0)'], |
| 45 | lightShades: ['oklch(0.58 0 0)', 'oklch(0.48 0 0)', 'oklch(0.38 0 0)', 'oklch(0.28 0 0)', 'oklch(0.18 0 0)'], | |
| 42 | 46 | }, |
| 43 | ] as const | |
| 47 | ] | |
| 44 | 48 | |
| 45 | 49 | const accentColor = useStorage(AccentColorStorageKey, 'ayanami') |
| 46 | 50 | </script> |
| @@ -65,7 +69,7 @@ const accentColor = useStorage(AccentColorStorageKey, 'ayanami') | ||
| 65 | 69 | <span class="accent-label">{{ option.label }}</span> |
| 66 | 70 | <span class="accent-shades"> |
| 67 | 71 | <span |
| 68 | v-for="(shade, i) in option.shades" | |
| 72 | v-for="(shade, i) in ('lightShades' in option && !isDark ? option.lightShades : option.shades)" | |
| 69 | 73 | :key="i" |
| 70 | 74 | class="accent-shade" |
| 71 | 75 | :style="{ backgroundColor: shade }" |