forked from primer/stylelint-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcolors.js
37 lines (35 loc) · 1.08 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
const {createVariableRule} = require('./lib/variable-rules')
const bgVars = [
'$bg-*',
'$tooltip-background-color',
// Match variables in any of the following formats: --color-bg-*, --color-*-bg-*, --color-*-bg
/var\(--color-(.+-)*bg(-.+)*\)/,
/var\(--color-[^)]+\)/
]
module.exports = 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
/var\(--color-(.+-)*text(-.+)*\)/,
/var\(--color-(.+-)*fg(-.+)*\)/,
/var\(--color-[^)]+\)/
]
}
},
'https://primer.style/primitives/colors'
)