Skip to content

Commit

Permalink
dark mode should have precedence over prefers contrast variants
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinMalfait committed May 23, 2022
1 parent aa39253 commit a71ee5c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/lib/setupContextUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -606,11 +606,11 @@ function resolvePlugins(context, root) {
let afterVariants = [
variantPlugins['directionVariants'],
variantPlugins['reducedMotionVariants'],
variantPlugins['prefersContrastVariants'],
variantPlugins['darkVariants'],
variantPlugins['printVariant'],
variantPlugins['screenVariants'],
variantPlugins['orientationVariants'],
variantPlugins['prefersContrastVariants'],
]

return [...corePluginList, ...beforeVariants, ...userPlugins, ...afterVariants, ...layerPlugins]
Expand Down
24 changes: 12 additions & 12 deletions tests/variants.test.css
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,18 @@
var(--tw-shadow);
}
}
@media (prefers-contrast: more) {
.contrast-more\:bg-yellow-300 {
--tw-bg-opacity: 1;
background-color: rgb(253 224 71 / var(--tw-bg-opacity));
}
}
@media (prefers-contrast: less) {
.contrast-less\:bg-yellow-300 {
--tw-bg-opacity: 1;
background-color: rgb(253 224 71 / var(--tw-bg-opacity));
}
}
.dark .dark\:shadow-md {
--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);
Expand Down Expand Up @@ -878,15 +890,3 @@
background-color: rgb(253 224 71 / var(--tw-bg-opacity));
}
}
@media (prefers-contrast: more) {
.contrast-more\:bg-yellow-300 {
--tw-bg-opacity: 1;
background-color: rgb(253 224 71 / var(--tw-bg-opacity));
}
}
@media (prefers-contrast: less) {
.contrast-less\:bg-yellow-300 {
--tw-bg-opacity: 1;
background-color: rgb(253 224 71 / var(--tw-bg-opacity));
}
}

0 comments on commit a71ee5c

Please sign in to comment.