effects
backdropInvert
Inverts the colours showing through the element's translucent background.
import { backdropInvert } from "@sdxc/u/effects";Quick reference
Every documented call, beside the CSS it emits.
| Call | CSS |
|---|---|
u.backdropInvert() | css({ "--ui-backdrop-invert": "1", backdropFilter: "... invert(var(--ui-backdrop-invert, 0)) ...", WebkitBackdropFilter: "... invert(var(--ui-backdrop-invert, 0)) ..." }) |
u.transparencySafe(u.backdropInvert(0.15)) | css({ "@media (prefers-reduced-transparency: no-preference)": { "--ui-backdrop-invert": "0.15", backdropFilter: "...", WebkitBackdropFilter: "..." } }) |
Using a custom value
Every scale argument also takes a raw CSS value, which passes through untouched.
u.backdropInvert()Applying on a state
Wrap the call in a state utility to scope it to one selector.
u.hover(u.backdropInvert())Responsive design
Wrap the call in a container query to scope it to one width.
u.at("md", u.backdropInvert())Customizing the theme
The custom properties this utility reads, which a theme redefines.
| Variable |
|---|
--ui-backdrop-invert |
Signature
u.backdropInvert(value?: number | (string & {}))