sdxc

Type to search, or start from one of these:

effects

grayscale

Applies a filter: grayscale(...), desaturating toward grey; 1 (the default) is fully grey, dimming an inactive element while its layout holds.

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

Quick reference

Every documented call, beside the CSS it emits.

CallCSS
u.grayscale()css({ "--ui-filter-grayscale": "1", filter: "... grayscale(var(--ui-filter-grayscale, 0)) ..." })

Using a custom value

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

u.grayscale()

Applying on a state

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

u.hover(u.grayscale())

Responsive design

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

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

Customizing the theme

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

Variable
--ui-filter-grayscale

Signature

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