-
Notifications
You must be signed in to change notification settings - Fork 22
/
colors.js
43 lines (41 loc) · 1.37 KB
/
colors.js
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
37
38
39
40
41
42
43
import {createVariableRule} from './lib/variable-rules.js'
const bgVars = [
'$bg-*',
'$tooltip-background-color',
// Match variables in any of the following formats: --color-bg-*, --color-*-bg-*, --color-*-bg, *bgColor*, *fgColor*, *borderColor*, *iconColor*
/var\(--color-(.+-)*bg(-.+)*\)/,
/var\(--color-[^)]+\)/,
/var\((.+-)*bgColor(-.+)*\)/,
/var\((.+-)*fgColor(-.+)*\)/,
/var\((.+-)*borderColor(-.+)*\)/,
/var\((.+-)*iconColor(-.+)*\)/,
]
export default createVariableRule(
'primer/colors',
{
'background-color': {
expects: 'a background color variable',
values: bgVars.concat('none', 'transparent'),
},
background: {
expects: 'a background color variable',
values: bgVars.concat('none', 'transparent', 'top', 'right', 'bottom', 'left', 'center', '*px', 'url(*)'),
},
'text color': {
expects: 'a text color variable',
props: 'color',
values: [
'$text-*',
'$tooltip-text-color',
'inherit',
// Match variables in any of the following formats: --color-text-*, --color-*-text-*, --color-*-text, *fgColor*, *iconColor*
/var\(--color-(.+-)*text(-.+)*\)/,
/var\(--color-(.+-)*fg(-.+)*\)/,
/var\(--color-[^)]+\)/,
/var\((.+-)*fgColor(-.+)*\)/,
/var\((.+-)*iconColor(-.+)*\)/,
],
},
},
'https://primer.style/primitives/colors',
)