Skip to content

Commit 1010706

Browse files
committed
feat(unocss): use primevue theme colors
1 parent b29cdb8 commit 1010706

File tree

4 files changed

+42
-4
lines changed

4 files changed

+42
-4
lines changed

app/components/ToDo.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ defineProps({
1010
<template>
1111
<div>
1212
<div class="todo m-4 flex gap-2">
13-
<i class="i-mdi-information text-3xl text-[color:var(--primary-color)]" />
13+
<i class="i-mdi-information text-3xl text-primary" />
1414
<div data-testid="test_todo" class="text-2xl">
1515
{{ text }}
1616
</div>

app/components/app/AppSidebar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ onMounted(() => {
5151
</div>
5252
</template>
5353
<template #footer>
54-
<div class="m-2 text-center text-xs text-color-[var(--primary-color)]">
54+
<div class="m-2 text-center text-xs text-color-primary">
5555
<span v-if="!collapsed">MongoCamp Admin {{ config.public.APP_VERSION }}</span>
5656
<span v-if="collapsed">{{ config.public.APP_VERSION }}</span>
5757
</div>

app/pages/data/stores.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,6 @@ onMounted(async () => {
5050

5151
<style lang='scss' scoped>
5252
h5 {
53-
color: var(--primary-color)
53+
color: var(--p-primary-color)
5454
}
5555
</style>

uno.config.ts

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,52 @@ import {
99
transformerVariantGroup,
1010
} from 'unocss'
1111

12+
function convert(color: string) {
13+
return `color-mix(in srgb, ${color} calc(100% * <alpha-value>), transparent)`
14+
}
15+
1216
export default defineConfig({
1317
shortcuts: [
1418
['btn', 'px-4 py-1 rounded inline-block bg-teal-600 text-white cursor-pointer hover:bg-teal-700 disabled:cursor-default disabled:bg-gray-600 disabled:opacity-50'],
1519
],
1620
theme: {
1721
colors: {
18-
// ...
22+
'primary': convert('var(--p-primary-color)'),
23+
'primary-emphasis': convert('var(--p-primary-hover-color)'),
24+
'primary-emphasis-alt': convert('var(--p-primary-active-color)'),
25+
'primary-contrast': convert('var(--p-primary-contrast-color)'),
26+
'primary-50': convert('var(--p-primary-50)'),
27+
'primary-100': convert('var(--p-primary-100)'),
28+
'primary-200': convert('var(--p-primary-200)'),
29+
'primary-300': convert('var(--p-primary-300)'),
30+
'primary-400': convert('var(--p-primary-400)'),
31+
'primary-500': convert('var(--p-primary-500)'),
32+
'primary-600': convert('var(--p-primary-600)'),
33+
'primary-700': convert('var(--p-primary-700)'),
34+
'primary-800': convert('var(--p-primary-800)'),
35+
'primary-900': convert('var(--p-primary-900)'),
36+
'primary-950': convert('var(--p-primary-950)'),
37+
'surface-0': convert('var(--p-surface-0)'),
38+
'surface-50': convert('var(--p-surface-50)'),
39+
'surface-100': convert('var(--p-surface-100)'),
40+
'surface-200': convert('var(--p-surface-200)'),
41+
'surface-300': convert('var(--p-surface-300)'),
42+
'surface-400': convert('var(--p-surface-400)'),
43+
'surface-500': convert('var(--p-surface-500)'),
44+
'surface-600': convert('var(--p-surface-600)'),
45+
'surface-700': convert('var(--p-surface-700)'),
46+
'surface-800': convert('var(--p-surface-800)'),
47+
'surface-900': convert('var(--p-surface-900)'),
48+
'surface-950': convert('var(--p-surface-950)'),
49+
},
50+
breakpoints: {
51+
sm: '640px',
52+
md: '768px',
53+
lg: '1024px',
54+
xl: '1280px',
55+
xxl: '1536px',
1956
},
57+
2058
},
2159
presets: [
2260
presetUno(),

0 commit comments

Comments
 (0)