Skip to content

Commit 3e8fefa

Browse files
committed
chore: change default accent color
1 parent bf4b537 commit 3e8fefa

File tree

3 files changed

+19
-24
lines changed

3 files changed

+19
-24
lines changed

app/assets/main.css

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
--border-hover: oklch(0.371 0 0);
2525

2626
/* accent color, set by user from settings */
27-
--accent: var(--accent-color, oklch(1 0 0));
27+
--accent: var(--accent-color, oklch(0.787 0.128 230.318));
2828
--accent-muted: var(--accent-color, oklch(0.922 0 0));
2929

3030
/* accent colors */
@@ -34,6 +34,7 @@
3434
--swatch-sky: oklch(0.787 0.128 230.318);
3535
--swatch-violet: oklch(0.78 0.148 286.067);
3636
--swatch-magenta: oklch(0.78 0.15 330);
37+
--swatch-neutral: oklch(1 0 0);
3738

3839
/* syntax highlighting colors */
3940
--syntax-fn: oklch(0.727 0.137 299.149);
@@ -94,7 +95,7 @@
9495
--border-subtle: oklch(0.922 0 0);
9596
--border-hover: oklch(0.715 0 0);
9697

97-
--accent: var(--accent-color, oklch(0.145 0 0));
98+
--accent: var(--accent-color, oklch(0.7 0.15 230.318));
9899
--accent-muted: var(--accent-color, oklch(0.205 0 0));
99100

100101
/* accent colors */
@@ -104,6 +105,7 @@
104105
--swatch-sky: oklch(0.7 0.15 230.318);
105106
--swatch-violet: oklch(0.7 0.17 286.067);
106107
--swatch-magenta: oklch(0.75 0.18 330);
108+
--swatch-neutral: oklch(0.145 0 0);
107109

108110
--syntax-fn: oklch(0.502 0.188 294.988);
109111
--syntax-str: oklch(0.425 0.152 252);

app/components/Settings/AccentColorPicker.vue

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const { accentColors, selectedAccentColor, setAccentColor } = useAccentColor()
55
66
onPrehydrate(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>

shared/utils/constants.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,22 @@ export const LIKES_SCOPE = `repo:${dev.npmx.feed.like.$nsid}`
4949
// Theming
5050
export const ACCENT_COLORS = {
5151
light: {
52+
sky: 'oklch(0.70 0.15 230.318)',
5253
coral: 'oklch(0.70 0.19 14.75)',
5354
amber: 'oklch(0.8 0.25 84.429)',
5455
emerald: 'oklch(0.70 0.17 166.95)',
55-
sky: 'oklch(0.70 0.15 230.318)',
5656
violet: 'oklch(0.70 0.17 286.067)',
5757
magenta: 'oklch(0.75 0.18 330)',
58+
neutral: 'oklch(0.145 0 0)',
5859
},
5960
dark: {
61+
sky: 'oklch(0.787 0.128 230.318)',
6062
coral: 'oklch(0.704 0.177 14.75)',
6163
amber: 'oklch(0.828 0.165 84.429)',
6264
emerald: 'oklch(0.792 0.153 166.95)',
63-
sky: 'oklch(0.787 0.128 230.318)',
6465
violet: 'oklch(0.78 0.148 286.067)',
6566
magenta: 'oklch(0.78 0.15 330)',
67+
neutral: 'oklch(1 0 0)',
6668
},
6769
} as const
6870

0 commit comments

Comments
 (0)