Commit 1c25771aa1
Unsigned
Layout: unified · split
docs/.vitepress/theme/components/settings/AccentColor.vue +64 −18
| @@ -5,12 +5,36 @@ import { AccentColorStorageKey } from '../../constants' | |||
| 5 | import MenuTitle from './MenuTitle.vue' | 5 | import MenuTitle from './MenuTitle.vue' |
| 6 | 6 | ||
| 7 | const accentOptions = [ | 7 | const accentOptions = [ |
| 8 | { key: 'ayanami', label: 'Ayanami', color: 'oklch(0.626 0.098 247.46)' }, | 8 | { |
| 9 | { key: 'asuka', label: 'Asuka', color: '#F35640' }, | 9 | key: 'ayanami', |
| 10 | { key: 'raora', label: 'Raora', color: '#F44088' }, | 10 | label: 'Ayanami', |
| 11 | { key: 'rebecca', label: 'Rebecca', color: '#18CF7A' }, | 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 | { key: 'okayu', label: 'Okayu', color: '#BC87C5' }, | 12 | }, |
| 13 | { key: 'inanis', label: "Ina'nis", color: '#8F81B0' }, | 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 | ] as const | 38 | ] as const |
| 15 | 39 | ||
| 16 | const accentColor = useStorage(AccentColorStorageKey, 'ayanami') | 40 | const accentColor = useStorage(AccentColorStorageKey, 'ayanami') |
| @@ -23,34 +47,41 @@ const accentColor = useStorage(AccentColorStorageKey, 'ayanami') | |||
| 23 | <span i-lucide:palette mr-1 aria-hidden="true" /> | 47 | <span i-lucide:palette mr-1 aria-hidden="true" /> |
| 24 | </template> | 48 | </template> |
| 25 | </MenuTitle> | 49 | </MenuTitle> |
| 26 | <div class="accent-grid"> | 50 | <div class="accent-list"> |
| 27 | <button | 51 | <button |
| 28 | v-for="option in accentOptions" | 52 | v-for="option in accentOptions" |
| 29 | :key="option.key" | 53 | :key="option.key" |
| 30 | class="accent-btn" | 54 | class="accent-btn" |
| 55 | :class="{ 'accent-btn--selected': accentColor === option.key }" | ||
| 31 | :aria-pressed="accentColor === option.key" | 56 | :aria-pressed="accentColor === option.key" |
| 32 | :aria-label="option.label" | 57 | :aria-label="option.label" |
| 33 | @click="accentColor = option.key" | 58 | @click="accentColor = option.key" |
| 34 | > | 59 | > |
| 35 | <span class="accent-swatch" :style="{ backgroundColor: option.color }" /> | ||
| 36 | <span class="accent-label">{{ option.label }}</span> | 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 | </button> | 69 | </button> |
| 39 | </div> | 70 | </div> |
| 40 | </div> | 71 | </div> |
| 41 | </template> | 72 | </template> |
| 42 | 73 | ||
| 43 | <style scoped> | 74 | <style scoped> |
| 44 | .accent-grid { | 75 | .accent-list { |
| 45 | display: grid; | 76 | display: flex; |
| 46 | grid-template-columns: 1fr 1fr; | 77 | flex-direction: column; |
| 47 | gap: 2px; | 78 | gap: 2px; |
| 48 | } | 79 | } |
| 49 | 80 | ||
| 50 | .accent-btn { | 81 | .accent-btn { |
| 51 | display: flex; | 82 | display: flex; |
| 52 | align-items: center; | 83 | align-items: center; |
| 53 | gap: 6px; | 84 | gap: 8px; |
| 54 | padding: 5px 8px; | 85 | padding: 5px 8px; |
| 55 | border-radius: 8px; | 86 | border-radius: 8px; |
| 56 | border: none; | 87 | border: none; |
| @@ -66,15 +97,30 @@ const accentColor = useStorage(AccentColorStorageKey, 'ayanami') | |||
| 66 | background-color: var(--vp-c-bg-soft); | 97 | background-color: var(--vp-c-bg-soft); |
| 67 | } | 98 | } |
| 68 | 99 | ||
| 69 | .accent-swatch { | 100 | .accent-btn--selected { |
| 70 | width: 16px; | 101 | background-color: var(--vp-c-brand-soft); |
| 71 | height: 16px; | 102 | } |
| 72 | border-radius: 50%; | 103 | |
| 73 | flex-shrink: 0; | 104 | .accent-btn--selected:hover { |
| 105 | background-color: var(--vp-c-brand-soft); | ||
| 74 | } | 106 | } |
| 75 | 107 | ||
| 76 | .accent-label { | 108 | .accent-label { |
| 77 | flex: 1; | 109 | flex: 1; |
| 78 | text-align: left; | 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 | </style> | 126 | </style> |