Skip to content

Commit 8b27a13

Browse files
committed
fix download chart
1 parent 3066df9 commit 8b27a13

4 files changed

Lines changed: 43 additions & 38 deletions

File tree

app/components/AppLogo.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ defineProps<{
2020
fill="var(--accent)"
2121
x="320"
2222
y="370"
23-
font-family="ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace"
23+
font-family="'Geist Mono',ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace"
2424
font-size="420"
2525
font-weight="500"
2626
text-anchor="middle"

app/components/PackageWeeklyDownloadStats.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ const isDarkMode = computed(() => resolvedMode.value === 'dark')
6464
6565
const accentColorValueById = computed<Record<string, string>>(() => {
6666
const map: Record<string, string> = {}
67-
for (const item of accentColors) {
67+
for (const item of accentColors.value) {
6868
map[item.id] = item.value
6969
}
7070
return map

app/composables/useSettings.ts

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -72,33 +72,44 @@ export function useAccentColor() {
7272
const { settings } = useSettings()
7373
const colorMode = useColorMode()
7474

75-
const accentColors = computed(() =>
76-
Object.entries(ACCENT_COLORS[colorMode.value as 'light' | 'dark']).map(([id, value]) => ({
75+
const accentColors = computed(() => {
76+
const mode = (colorMode.value || 'dark') as 'light' | 'dark'
77+
const colors = ACCENT_COLORS[mode]
78+
79+
return Object.entries(colors).map(([id, value]) => ({
7780
id: id as AccentColorId,
7881
name: id,
7982
value,
80-
})),
81-
)
82-
83-
const currentAccentColor = computed(() => {
84-
const id = settings.value.accentColorId
85-
const theme = colorMode.value as 'light' | 'dark'
86-
return id ? ACCENT_COLORS[theme][id] : null
83+
}))
8784
})
8885

89-
// Simple client-side check
86+
function setAccentColor(id: AccentColorId | null) {
87+
const mode = (colorMode.value || 'dark') as 'light' | 'dark'
88+
const color = id ? ACCENT_COLORS[mode][id] : null
89+
90+
if (color) {
91+
document.documentElement.style.setProperty('--accent-color', color)
92+
} else {
93+
document.documentElement.style.removeProperty('--accent-color')
94+
}
95+
96+
settings.value.accentColorId = id
97+
}
98+
99+
// Apply color on mount and when theme changes
90100
if (process.client) {
91-
watchEffect(() => {
92-
if (currentAccentColor.value) {
93-
document.documentElement.style.setProperty('--accent-color', currentAccentColor.value)
94-
} else {
95-
document.documentElement.style.removeProperty('--accent-color')
96-
}
101+
onMounted(() => {
102+
const id = settings.value.accentColorId
103+
if (id) setAccentColor(id)
97104
})
98-
}
99105

100-
function setAccentColor(id: AccentColorId | null) {
101-
settings.value.accentColorId = id
106+
watch(
107+
() => colorMode.value,
108+
() => {
109+
const id = settings.value.accentColorId
110+
if (id) setAccentColor(id)
111+
},
112+
)
102113
}
103114

104115
return {

public-dev/logo.svg

Lines changed: 11 additions & 17 deletions
Loading

0 commit comments

Comments
 (0)