Skip to content

Commit be6d76f

Browse files
committed
refactor: use predefined color token
1 parent 772df63 commit be6d76f

File tree

1 file changed

+2
-25
lines changed

1 file changed

+2
-25
lines changed

app/pages/share-card/[[org]]/[name].vue

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,9 @@
11
<script setup lang="ts">
2-
import { ACCENT_COLOR_IDS, type AccentColorId } from '#shared/utils/constants'
2+
import { ACCENT_COLOR_IDS, ACCENT_COLOR_TOKENS, type AccentColorId } from '#shared/utils/constants'
33
44
// This page exists only as a rendering target for nuxt-og-image.
55
// Visiting it directly redirects to the package page.
66
7-
// Hex equivalents of ACCENT_COLORS for satori (which doesn't support oklch).
8-
// These approximate the oklch values visually.
9-
const ACCENT_HEX: Record<'light' | 'dark', Record<AccentColorId, string>> = {
10-
dark: {
11-
sky: '#5bc4e0',
12-
coral: '#f07858',
13-
amber: '#f0c040',
14-
emerald: '#40d088',
15-
violet: '#9880e8',
16-
magenta: '#d878c0',
17-
neutral: '#ffffff',
18-
},
19-
light: {
20-
sky: '#2870c0',
21-
coral: '#c04030',
22-
amber: '#b07020',
23-
emerald: '#208060',
24-
violet: '#7050b8',
25-
magenta: '#a040a0',
26-
neutral: '#1a1a1a',
27-
},
28-
}
29-
307
const route = useRoute()
318
const org = (route.params as any).org as string | undefined
329
const name = (route.params as any).name as string
@@ -37,7 +14,7 @@ const color: AccentColorId = ACCENT_COLOR_IDS.includes(colorParam as AccentColor
3714
? (colorParam as AccentColorId)
3815
: 'sky'
3916
40-
const primaryColor = ACCENT_HEX[theme][color]
17+
const primaryColor = ACCENT_COLOR_TOKENS[color][theme].hex
4118
4219
defineOgImageComponent(
4320
'ShareCard',

0 commit comments

Comments
 (0)