forked from DaPotatoMan/cryptoclock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
windi.colors.ts
35 lines (30 loc) · 874 Bytes
/
windi.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
interface OpacityVars {
opacityVariable: string;
opacityValue: number;
}
function createColor(variable: string) {
return (config: OpacityVars) => {
const { opacityValue, opacityVariable } = config;
if (opacityValue !== undefined) {
return `rgba(var(--${variable}), ${opacityValue})`;
}
if (opacityVariable !== undefined) {
return `rgba(var(--${variable}), var(${opacityVariable}, 1))`;
}
return `rgb(var(--${variable}))`;
};
}
export default {
colors: {
accent: '#6968DD'
},
textColor: {
default: createColor('color-text-default'),
inverse: createColor('color-text-inverse'),
},
backgroundColor: {
inverse: createColor('color-bg-inverse'),
default: createColor('color-bg-default'),
'default-elevated': createColor('color-bg-default-elevated'),
}
};