@@ -5,6 +5,7 @@ const { accentColors, selectedAccentColor, setAccentColor } = useAccentColor()
55
66onPrehydrate (el => {
77 const settings = JSON .parse (localStorage .getItem (' npmx-settings' ) || ' {}' )
8+ const defaultId = ' sky'
89 const id = settings .accentColorId
910 if (id ) {
1011 const input = el .querySelector <HTMLInputElement >(` input[value="${id }"] ` )
@@ -13,10 +14,12 @@ onPrehydrate(el => {
1314 input .setAttribute (' checked' , ' ' )
1415 }
1516 // Remove checked from the server-default (clear button, value="")
16- const clearInput = el .querySelector <HTMLInputElement >(' input[value=""]' )
17- if (clearInput ) {
18- clearInput .checked = false
19- clearInput .removeAttribute (' checked' )
17+ if (id !== defaultId ) {
18+ const clearInput = el .querySelector <HTMLInputElement >(` input[value="${defaultId }"] ` )
19+ if (clearInput ) {
20+ clearInput .checked = false
21+ clearInput .removeAttribute (' checked' )
22+ }
2023 }
2124 }
2225})
@@ -31,31 +34,19 @@ onPrehydrate(el => {
3134 v-for =" color in accentColors"
3235 :key =" color.id"
3336 class =" size-6 rounded-full transition-transform duration-150 motion-safe:hover:scale-110 has-[:checked]:(ring-2 ring-fg ring-offset-2 ring-offset-bg-subtle) has-[:focus-visible]:(ring-2 ring-fg ring-offset-2 ring-offset-bg-subtle)"
37+ :class =" color.id === 'neutral' ? 'flex items-center justify-center bg-fg' : ''"
3438 :style =" { backgroundColor: `var(--swatch-${color.id})` }"
3539 >
3640 <input
3741 type =" radio"
3842 name =" accent-color"
3943 class =" sr-only"
4044 :value =" color.id"
41- :checked =" selectedAccentColor === color.id"
42- :aria-label =" color.name"
45+ :checked =" selectedAccentColor === color.id || (!selectedAccentColor && color.id === 'sky') "
46+ :aria-label =" color.id === 'neutral' ? $t('settings.clear_accent') : color. name"
4347 @change =" setAccentColor(color.id)"
4448 />
45- </label >
46- <label
47- class =" size-6 rounded-full transition-transform duration-150 motion-safe:hover:scale-110 has-[:checked]:(ring-2 ring-fg ring-offset-2 ring-offset-bg-subtle) has-[:focus-visible]:(ring-2 ring-fg ring-offset-2 ring-offset-bg-subtle) flex items-center justify-center bg-fg"
48- >
49- <input
50- type =" radio"
51- name =" accent-color"
52- class =" sr-only"
53- value =" "
54- :checked =" selectedAccentColor === null"
55- :aria-label =" $t('settings.clear_accent')"
56- @change =" setAccentColor(null)"
57- />
58- <span class =" i-lucide:ban size-4 text-bg" aria-hidden =" true" />
49+ <span v-if =" color.id === 'neutral'" class =" i-lucide:ban size-4 text-bg" aria-hidden =" true" />
5950 </label >
6051 </fieldset >
6152</template >
0 commit comments