Skip to content
This repository was archived by the owner on May 27, 2021. It is now read-only.

Commit bbd8749

Browse files
Add variant for nth-child(odd) pseudo-selector (#13)
1 parent 956a73a commit bbd8749

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Variants for dark mode are based on [Tailwind's own variants](https://tailwindcs
2828
- `dark-active`
2929
- `dark-group-hover`
3030
- `dark-focus-within`
31+
- `dark-odd`
3132

3233
... and are used in the same way.
3334

@@ -49,7 +50,7 @@ As with existing variants such as `hover` and `focus`, variants for dark mode mu
4950

5051
```javascript
5152
variants: {
52-
backgroundColor: ['dark', 'dark-hover', 'dark-group-hover'],
53+
backgroundColor: ['dark', 'dark-hover', 'dark-group-hover', 'dark-odd'],
5354
borderColor: ['dark', 'dark-focus', 'dark-focus-within'],
5455
textColor: ['dark', 'dark-hover', 'dark-active']
5556
}

index.js

+6
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,11 @@ module.exports = function() {
3636
return `${darkSelector} .${e(`dark-focus-within${separator}${className}`)}:focus-within`;
3737
});
3838
});
39+
40+
addVariant('dark-odd', ({modifySelectors, separator}) => {
41+
modifySelectors(({className}) => {
42+
return `${darkSelector} .${e(`dark-odd${separator}${className}`)}:nth-child(odd)`;
43+
});
44+
});
3945
};
4046
};

0 commit comments

Comments
 (0)