sdxc

Type to search, or start from one of these:

effects

backdropGrayscale

Desaturates the backdrop toward grey (1 fully, 0 untouched) so a coloured overlay reads as the only hue in the area.

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

Quick reference

Every documented call, beside the CSS it emits.

CallCSS
u.backdropGrayscale()css({ "--ui-backdrop-grayscale": "1", backdropFilter: "... grayscale(var(--ui-backdrop-grayscale, 0)) ...", WebkitBackdropFilter: "... grayscale(var(--ui-backdrop-grayscale, 0)) ..." })
u.transparencySafe(u.backdropGrayscale(0.5))css({ "@media (prefers-reduced-transparency: no-preference)": { "--ui-backdrop-grayscale": "0.5", backdropFilter: "...", WebkitBackdropFilter: "..." } })

Using a custom value

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

u.backdropGrayscale()

Applying on a state

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

u.hover(u.backdropGrayscale())

Responsive design

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

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

Customizing the theme

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

Variable
--ui-backdrop-grayscale

Signature

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