Skip to content

Commit

Permalink
Add mix-blend-mode utilities
Browse files Browse the repository at this point in the history
  • Loading branch information
adamwathan committed Apr 3, 2021
1 parent 21a96af commit 27bce5c
Show file tree
Hide file tree
Showing 12 changed files with 1,573 additions and 0 deletions.
384 changes: 384 additions & 0 deletions __tests__/fixtures/tailwind-output-flagged.css

Large diffs are not rendered by default.

384 changes: 384 additions & 0 deletions __tests__/fixtures/tailwind-output-important.css

Large diffs are not rendered by default.

384 changes: 384 additions & 0 deletions __tests__/fixtures/tailwind-output-no-color-opacity.css

Large diffs are not rendered by default.

384 changes: 384 additions & 0 deletions __tests__/fixtures/tailwind-output.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions jit/corePlugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ module.exports = {
placeholderOpacity: require('./placeholderOpacity'),

opacity: require('./opacity'),
mixBlendMode: require('./mixBlendMode'),
boxShadow: require('./boxShadow'),
outline: require('./outline'),
ringWidth: require('./ringWidth'),
Expand Down
1 change: 1 addition & 0 deletions jit/corePlugins/mixBlendMode.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('../../lib/plugins/mixBlendMode').default()
6 changes: 6 additions & 0 deletions jit/tests/basic-usage.test.css
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,12 @@
.opacity-90 {
opacity: 0.9;
}
.mix-multiply {
mix-blend-mode: multiply;
}
.mix-saturation {
mix-blend-mode: saturation;
}
.shadow-md {
--tw-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000),
Expand Down
1 change: 1 addition & 0 deletions jit/tests/basic-usage.test.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
<div class="object-cover"></div>
<div class="object-bottom"></div>
<div class="opacity-90"></div>
<div class="mix-multiply mix-saturation"></div>
<div class="order-last order-2"></div>
<div class="outline-none outline-black"></div>
<div class="overflow-hidden"></div>
Expand Down
1 change: 1 addition & 0 deletions src/corePluginList.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,5 @@ export const corePluginList = [
'transitionDuration',
'transitionDelay',
'animation',
'mixBlendMode',
]
1 change: 1 addition & 0 deletions src/plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export { default as maxHeight } from './maxHeight'
export { default as maxWidth } from './maxWidth'
export { default as minHeight } from './minHeight'
export { default as minWidth } from './minWidth'
export { default as mixBlendMode } from './mixBlendMode'
export { default as objectFit } from './objectFit'
export { default as objectPosition } from './objectPosition'
export { default as opacity } from './opacity'
Expand Down
25 changes: 25 additions & 0 deletions src/plugins/mixBlendMode.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
export default function () {
return function ({ addUtilities, variants }) {
addUtilities(
{
'.mix-normal': { 'mix-blend-mode': 'normal' },
'.mix-multiply': { 'mix-blend-mode': 'multiply' },
'.mix-screen': { 'mix-blend-mode': 'screen' },
'.mix-overlay': { 'mix-blend-mode': 'overlay' },
'.mix-darken': { 'mix-blend-mode': 'darken' },
'.mix-lighten': { 'mix-blend-mode': 'lighten' },
'.mix-color-dodge': { 'mix-blend-mode': 'color-dodge' },
'.mix-color-burn': { 'mix-blend-mode': 'color-burn' },
'.mix-hard-light': { 'mix-blend-mode': 'hard-light' },
'.mix-soft-light': { 'mix-blend-mode': 'soft-light' },
'.mix-difference': { 'mix-blend-mode': 'difference' },
'.mix-exclusion': { 'mix-blend-mode': 'exclusion' },
'.mix-hue': { 'mix-blend-mode': 'hue' },
'.mix-saturation': { 'mix-blend-mode': 'saturation' },
'.mix-color': { 'mix-blend-mode': 'color' },
'.mix-luminosity': { 'mix-blend-mode': 'luminosity' },
},
variants('mixBlendMode')
)
}
}
1 change: 1 addition & 0 deletions stubs/defaultConfig.stub.js
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,7 @@ module.exports = {
maxWidth: ['responsive'],
minHeight: ['responsive'],
minWidth: ['responsive'],
mixBlendMode: ['responsive'],
objectFit: ['responsive'],
objectPosition: ['responsive'],
opacity: ['responsive', 'group-hover', 'focus-within', 'hover', 'focus'],
Expand Down

0 comments on commit 27bce5c

Please sign in to comment.