Skip to content

Commit

Permalink
Add inverted-colors variant
Browse files Browse the repository at this point in the history
  • Loading branch information
lukewarlow committed Jul 26, 2023
1 parent e0c52a9 commit b6fd78e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/corePlugins.js
Expand Up @@ -460,6 +460,10 @@ export let variantPlugins = {
addVariant('contrast-more', '@media (prefers-contrast: more)')
addVariant('contrast-less', '@media (prefers-contrast: less)')
},

invertedColorsVariants: ({ addVariant }) => {
addVariant('inverted-colors', '@media (inverted-colors: inverted)')
},
}

let cssTransformValue = [
Expand Down
1 change: 1 addition & 0 deletions src/lib/setupContextUtils.js
Expand Up @@ -759,6 +759,7 @@ function resolvePlugins(context, root) {
variantPlugins['printVariant'],
variantPlugins['screenVariants'],
variantPlugins['orientationVariants'],
variantPlugins['invertedColorsVariants'],
]

return [...corePluginList, ...beforeVariants, ...userPlugins, ...afterVariants, ...layerPlugins]
Expand Down
9 changes: 9 additions & 0 deletions tests/plugins/variants/invertedColorsVariants.test.js
@@ -0,0 +1,9 @@
import { css, quickVariantPluginTest } from '../../util/run'

quickVariantPluginTest('invertedColorsVariants').toMatchFormattedCss(css`
@media (inverted-colors: inverted) {
.inverted-colors\:flex {
display: flex;
}
}
`)

0 comments on commit b6fd78e

Please sign in to comment.