Skip to content

Commit 26136d6

Browse files
committed
feat: backdropBrightness plugin
1 parent 7ce9fe6 commit 26136d6

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

src/filters.js

+11
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ module.exports = {
1212
saturate: false,
1313
sepia: false,
1414
backdropBlur: false,
15+
backdropBrightness: false,
1516
},
1617
blur: plugin(function({ matchUtilities, theme }) {
1718
matchUtilities(
@@ -115,4 +116,14 @@ module.exports = {
115116
{ values: theme('backdropBlur') }
116117
)
117118
}),
119+
backdropBrightness: plugin(function({ matchUtilities, theme }) {
120+
matchUtilities(
121+
{
122+
'backdrop-brightness': (value) => ({
123+
backdropFilter: `brightness(${value})`
124+
}),
125+
},
126+
{ values: theme('backdropBrightness') }
127+
)
128+
}),
118129
}

src/index.test.js

+24
Original file line numberDiff line numberDiff line change
@@ -326,4 +326,28 @@ describe('Filters', () => {
326326
`)
327327
})
328328
})
329+
330+
test('backdropBrightness', () => {
331+
const config = {
332+
content: [
333+
{
334+
raw: String.raw`
335+
<hr class="backdrop-brightness-50">
336+
<hr class="backdrop-brightness-[1.75]">
337+
`
338+
}
339+
],
340+
}
341+
342+
return run(config).then(result => {
343+
expect(result.css).toMatchCss(String.raw`
344+
.backdrop-brightness-50 {
345+
backdrop-filter: brightness(.5)
346+
}
347+
.backdrop-brightness-\[1\.75\] {
348+
backdrop-filter: brightness(1.75)
349+
}
350+
`)
351+
})
352+
})
329353
})

0 commit comments

Comments
 (0)