sdxc

Type to search, or start from one of these:

effects

backdropContrast

Pushes the backdrop away from (above 1) or toward (below 1) mid-grey; flattening it to a uniform tone keeps overlaid text legible.

import { backdropContrast } from "@sdxc/u/effects";

Quick reference

Every documented call, beside the CSS it emits.

CallCSS
u.backdropContrast()css({ "--ui-backdrop-contrast": "1.25", backdropFilter: "... contrast(var(--ui-backdrop-contrast, 1)) ...", WebkitBackdropFilter: "... contrast(var(--ui-backdrop-contrast, 1)) ..." })
u.transparencySafe(u.backdropContrast(0.75))css({ "@media (prefers-reduced-transparency: no-preference)": { "--ui-backdrop-contrast": "0.75", backdropFilter: "...", WebkitBackdropFilter: "..." } })

Using a custom value

Every scale argument also takes a raw CSS value, which passes through untouched.

u.backdropContrast()

Applying on a state

Wrap the call in a state utility to scope it to one selector.

u.hover(u.backdropContrast())

Responsive design

Wrap the call in a container query to scope it to one width.

u.at("md", u.backdropContrast())

Customizing the theme

The custom properties this utility reads, which a theme redefines.

Variable
--ui-backdrop-contrast

Signature

u.backdropContrast(value?: number | (string & {}))