Skip to content

Commit 24d1912

Browse files
committed
docs: documenet how to use a custom color palette
1 parent f86c3d1 commit 24d1912

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

website/src/content/pages/theme/customize.mdx

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,76 @@ export default defineConfig({
2727
})
2828
```
2929

30+
## Custom Color Palette
31+
32+
You can define a custom accent color palette and integrate it into your project. Here's an example of how you can
33+
create a custom `coral` color palette:
34+
35+
```ts
36+
export const coral = {
37+
name: 'coral',
38+
tokens: defineTokens.colors({
39+
light: {
40+
'1': { value: '#fff8f7' },
41+
// ...
42+
'12': { value: '#762d25' },
43+
},
44+
dark: {
45+
'1': { value: '#1c1412' },
46+
// ...
47+
'12': { value: '#faa19b' },
48+
},
49+
}),
50+
51+
semanticTokens: defineSemanticTokens.colors({
52+
'1': { value: { _light: '{colors.coral.light.1}', _dark: '{colors.coral.dark.1}' } },
53+
// ...
54+
'12': { value: { _light: '{colors.coral.light.12}', _dark: '{colors.coral.dark.12}' } },
55+
56+
default: {
57+
value: {
58+
_light: '{colors.coral.light.9}',
59+
_dark: '{colors.coral.dark.9}',
60+
},
61+
},
62+
emphasized: {
63+
value: {
64+
_light: '{colors.coral.light.10}',
65+
_dark: '{colors.coral.dark.10}',
66+
},
67+
},
68+
fg: {
69+
value: {
70+
_light: 'white',
71+
_dark: 'white',
72+
},
73+
},
74+
text: {
75+
value: {
76+
_light: '{colors.coral.light.11}',
77+
_dark: '{colors.coral.dark.11}',
78+
},
79+
},
80+
}),
81+
}
82+
```
83+
84+
> Since **Park UI** uses [Radix Colors](https://www.radix-ui.com/colors) under the hood, you can use their [tool](https://www.radix-ui.com/colors/custom) to generate your custom color palette.
85+
86+
And then you can use it in your `panda.config.ts` like this:
87+
88+
```ts
89+
import { defineConfig } from '@pandacss/dev'
90+
import { createPreset } from '@park-ui/panda-preset'
91+
import { createPreset } from '@park-ui/panda-preset/colors/sand'
92+
import coral from './coral'
93+
94+
export default defineConfig({
95+
presets: [createPreset({ grayColor: sand, accentColor: coral, radius: 'sm' })],
96+
// etc.
97+
})
98+
```
99+
30100
## Semantic Tokens
31101

32102
Another cool way to customize Park UI is by adjusting

0 commit comments

Comments
 (0)