Commit 1c25771aa1
Unsigned
Layout: unified · split
docs/.vitepress/theme/components/settings/AccentColor.vue +64 −18
| @@ -5,12 +5,36 @@ import { AccentColorStorageKey } from '../../constants' | ||
| 5 | 5 | import MenuTitle from './MenuTitle.vue' |
| 6 | 6 | |
| 7 | 7 | const accentOptions = [ |
| 8 | { key: 'ayanami', label: 'Ayanami', color: 'oklch(0.626 0.098 247.46)' }, | |
| 9 | { key: 'asuka', label: 'Asuka', color: '#F35640' }, | |
| 10 | { key: 'raora', label: 'Raora', color: '#F44088' }, | |
| 11 | { key: 'rebecca', label: 'Rebecca', color: '#18CF7A' }, | |
| 12 | { key: 'okayu', label: 'Okayu', color: '#BC87C5' }, | |
| 13 | { key: 'inanis', label: "Ina'nis", color: '#8F81B0' }, | |
| 8 | { | |
| 9 | key: 'ayanami', | |
| 10 | label: 'Ayanami', | |
| 11 | shades: ['oklch(0.722 0.105 247.48)', 'oklch(0.626 0.098 247.46)', 'oklch(0.523 0.081 246.86)', 'oklch(0.43 0.066 246.75)', 'oklch(0.335 0.052 246.76)'], | |
| 12 | }, | |
| 13 | { | |
| 14 | key: 'asuka', | |
| 15 | label: 'Asuka', | |
| 16 | shades: ['#FB7F6E', '#F35640', '#E2432D', '#BD2C18', '#9C2818'], | |
| 17 | }, | |
| 18 | { | |
| 19 | key: 'raora', | |
| 20 | label: 'Raora', | |
| 21 | shades: ['#FB6BA9', '#F44088', '#D91A5D', '#C6104B', '#A4103E'], | |
| 22 | }, | |
| 23 | { | |
| 24 | key: 'rebecca', | |
| 25 | label: 'Rebecca', | |
| 26 | shades: ['#41E799', '#18CF7A', '#0DAC62', '#0E874F', '#116A42'], | |
| 27 | }, | |
| 28 | { | |
| 29 | key: 'okayu', | |
| 30 | label: 'Okayu', | |
| 31 | shades: ['#CDA4D5', '#BC87C5', '#A86BB2', '#915799', '#794A7F'], | |
| 32 | }, | |
| 33 | { | |
| 34 | key: 'inanis', | |
| 35 | label: "Ina'nis", | |
| 36 | shades: ['#A39AC0', '#8F81B0', '#816FA1', '#776392', '#645479'], | |
| 37 | }, | |
| 14 | 38 | ] as const |
| 15 | 39 | |
| 16 | 40 | const accentColor = useStorage(AccentColorStorageKey, 'ayanami') |
| @@ -23,34 +47,41 @@ const accentColor = useStorage(AccentColorStorageKey, 'ayanami') | ||
| 23 | 47 | <span i-lucide:palette mr-1 aria-hidden="true" /> |
| 24 | 48 | </template> |
| 25 | 49 | </MenuTitle> |
| 26 | <div class="accent-grid"> | |
| 50 | <div class="accent-list"> | |
| 27 | 51 | <button |
| 28 | 52 | v-for="option in accentOptions" |
| 29 | 53 | :key="option.key" |
| 30 | 54 | class="accent-btn" |
| 55 | :class="{ 'accent-btn--selected': accentColor === option.key }" | |
| 31 | 56 | :aria-pressed="accentColor === option.key" |
| 32 | 57 | :aria-label="option.label" |
| 33 | 58 | @click="accentColor = option.key" |
| 34 | 59 | > |
| 35 | <span class="accent-swatch" :style="{ backgroundColor: option.color }" /> | |
| 36 | 60 | <span class="accent-label">{{ option.label }}</span> |
| 37 | <span v-if="accentColor === option.key" i-lucide:check text-xs ml-auto /> | |
| 61 | <span class="accent-shades"> | |
| 62 | <span | |
| 63 | v-for="(shade, i) in option.shades" | |
| 64 | :key="i" | |
| 65 | class="accent-shade" | |
| 66 | :style="{ backgroundColor: shade }" | |
| 67 | /> | |
| 68 | </span> | |
| 38 | 69 | </button> |
| 39 | 70 | </div> |
| 40 | 71 | </div> |
| 41 | 72 | </template> |
| 42 | 73 | |
| 43 | 74 | <style scoped> |
| 44 | .accent-grid { | |
| 45 | display: grid; | |
| 46 | grid-template-columns: 1fr 1fr; | |
| 75 | .accent-list { | |
| 76 | display: flex; | |
| 77 | flex-direction: column; | |
| 47 | 78 | gap: 2px; |
| 48 | 79 | } |
| 49 | 80 | |
| 50 | 81 | .accent-btn { |
| 51 | 82 | display: flex; |
| 52 | 83 | align-items: center; |
| 53 | gap: 6px; | |
| 84 | gap: 8px; | |
| 54 | 85 | padding: 5px 8px; |
| 55 | 86 | border-radius: 8px; |
| 56 | 87 | border: none; |
| @@ -66,15 +97,30 @@ const accentColor = useStorage(AccentColorStorageKey, 'ayanami') | ||
| 66 | 97 | background-color: var(--vp-c-bg-soft); |
| 67 | 98 | } |
| 68 | 99 | |
| 69 | .accent-swatch { | |
| 70 | width: 16px; | |
| 71 | height: 16px; | |
| 72 | border-radius: 50%; | |
| 73 | flex-shrink: 0; | |
| 100 | .accent-btn--selected { | |
| 101 | background-color: var(--vp-c-brand-soft); | |
| 102 | } | |
| 103 | ||
| 104 | .accent-btn--selected:hover { | |
| 105 | background-color: var(--vp-c-brand-soft); | |
| 74 | 106 | } |
| 75 | 107 | |
| 76 | 108 | .accent-label { |
| 77 | 109 | flex: 1; |
| 78 | 110 | text-align: left; |
| 79 | 111 | } |
| 112 | ||
| 113 | .accent-shades { | |
| 114 | display: flex; | |
| 115 | height: 1em; | |
| 116 | border-radius: 4px; | |
| 117 | overflow: hidden; | |
| 118 | flex-shrink: 0; | |
| 119 | } | |
| 120 | ||
| 121 | .accent-shade { | |
| 122 | width: 18px; | |
| 123 | height: 100%; | |
| 124 | } | |
| 125 | ||
| 80 | 126 | </style> |