sdxc

Type to search, or start from one of these:

effects

contrast

Applies a filter: contrast(...), pushing pixels away from (above 1) or toward (below 1) mid-grey; 0 flattens the element to uniform grey.

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

Quick reference

Every documented call, beside the CSS it emits.

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

Using a custom value

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

u.contrast("2.75rem")

Applying on a state

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

u.hover(u.contrast(1.25))

Responsive design

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

u.at("md", u.contrast(1.25))

Customizing the theme

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

Variable
--ui-filter-contrast

Signature

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