-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuno-radix-colors.ts
36 lines (32 loc) · 1.14 KB
/
uno-radix-colors.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
type RadixColors = typeof import("@radix-ui/colors");
type RadixColorName = keyof RadixColors;
import * as radixColors from "@radix-ui/colors";
const radixLightColors = Object.fromEntries(
Object.entries(radixColors).filter(([key, value]) => !key.includes("Dark"))
);
const radixDarkColors = Object.fromEntries(Object.entries(radixColors).filter(([key, value]) => key.includes("Dark")));
const mapSingleColor = (colorName: RadixColorName) => {
const color = radixColors[colorName];
return Object.fromEntries(Object.entries(color).map(([key, value], index) => [index + 1, value]));
};
const lightColorsConfig = Object.fromEntries(
Object.entries(radixLightColors).map(([key, value], index) => [key, mapSingleColor(key as RadixColorName)])
);
const darkColorsConfig = Object.fromEntries(
Object.entries(radixDarkColors).map(([key, value], index) => [
key.replace("Dark", ""),
mapSingleColor(key as RadixColorName),
])
);
export const lightTheme = {
colors: {
...lightColorsConfig,
prm: {...mapSingleColor("blue")},
},
};
export const darkTheme = {
colors: {
...darkColorsConfig,
prm: {...mapSingleColor("blueDark")},
},
};