sdxc

[ @sdxc/u/effects ]

sepia

Applies a filter: sepia(...), shifting the element toward a warm brown monochrome; 1 (the default) is a full conversion.

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

Quick reference

Every documented call, beside the CSS it emits.

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

Examples

Basic example

Use sepia(n) to tone an element toward a warm brown monochrome, where sepia() with no argument converts it fully:

sepia(0.25)
sepia(0.5)
sepia()
<div mix={[...]}>
	<div mix={[...]}>
		<img mix={[sepia(0.25), ...]} src={...} alt="" />
		<span mix={[...]}>sepia(0.25)</span>
	</div>
	<div mix={[...]}>
		<img mix={[sepia(0.5), ...]} src={...} alt="" />
		<span mix={[...]}>sepia(0.5)</span>
	</div>
	<div mix={[...]}>
		<img mix={[sepia(), ...]} src={...} alt="" />
		<span mix={[...]}>sepia()</span>
	</div>
</div>

Applying on a state

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

u.hover(u.sepia())

Responsive design

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

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

Signature

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

Written by Sergio Xalambrí. Follow @sergiodxa for new packages, or sponsor the work.