[ @sdxc/u/effects ]
backdropBrightness
Scales the backdrop's lightness — below 1 darkens, above 1 brightens — keeping overlaid text legible.
import { backdropBrightness } from "@sdxc/u/effects";Quick reference
Every documented call, beside the CSS it emits.
| Call | CSS |
|---|---|
u.backdropBrightness() | css({ "--ui-backdrop-brightness": "1.1", backdropFilter: "... brightness(var(--ui-backdrop-brightness, 1)) ...", WebkitBackdropFilter: "... brightness(var(--ui-backdrop-brightness, 1)) ..." }) |
u.transparencySafe(u.backdropBrightness(0.8)) | css({ "@media (prefers-reduced-transparency: no-preference)": { "--ui-backdrop-brightness": "0.8", backdropFilter: "...", WebkitBackdropFilter: "..." } }) |
Examples
Basic example
Use backdropBrightness(n) to darken what shows through an element below 1, or brighten it above 1:
backdropBrightness(0.5)
backdropBrightness(1.5)
<div mix={[...]}>
<div mix={[...]}>
<div mix={[backdropBrightness(0.5), ...]}>backdropBrightness(0.5)</div>
</div>
<div mix={[...]}>
<div mix={[backdropBrightness(1.5), ...]}>backdropBrightness(1.5)</div>
</div>
</div>Applying on a state
Wrap the call in a state utility to scope it to one selector.
u.hover(u.backdropBrightness())Responsive design
Wrap the call in a container query to scope it to one width.
u.at("md", u.backdropBrightness())Signature
u.backdropBrightness(value?: number | (string & {}))