-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
34 lines (27 loc) · 1.01 KB
/
index.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
module.exports = function ({addUtilities, theme}) {
const gridStriped = {};
const gridTheme = theme('gridStriped');
gridStriped['.striped'] = {
display: 'contents'
}
for (let i = 1; i <= 12; i++) {
gridStriped[`.striped-${i}`] = {
display: 'contents'
}
gridStriped[`.striped-${i} > div:nth-child(${i * 2}n+1)`] = {
backgroundColor: theme(`colors.${gridTheme['color']}.${gridTheme['variant']}`),
}
gridStriped[`.grid-cols-${i} .striped > div:nth-child(${i * 2}n+1)`] = {
backgroundColor: theme(`colors.${gridTheme['color']}.${gridTheme['variant']}`),
};
for (let j = 2; j <= i; j++) {
gridStriped[`.striped-${i} > div:nth-child(${i * 2}n+${j})`] = {
backgroundColor: theme(`colors.${gridTheme['color']}.${gridTheme['variant']}`),
}
gridStriped[`.grid-cols-${i} .striped > div:nth-child(${i * 2}n+${j})`] = {
backgroundColor: theme(`colors.${gridTheme['color']}.${gridTheme['variant']}`),
};
}
}
addUtilities(gridStriped)
}