CSS filter playground

Stack blur, brightness, contrast, saturation and the rest over a real photograph, and copy the result as filter, as backdrop-filter or as a Tailwind class.

A photograph carrying the current filter stack
filter.csscss
.photo {
  filter: brightness(110%) contrast(105%) saturate(120%);
}
backdrop.csscss
.panel {
  backdrop-filter: brightness(110%) contrast(105%) saturate(120%);
  -webkit-backdrop-filter: brightness(110%) contrast(105%) saturate(120%);
}
usage.tsxtsx
<img class="[filter:brightness(110%)_contrast(105%)_saturate(120%)]" />

Questions

What is the difference between filter and backdrop-filter?+

filter paints the element itself; backdrop-filter paints whatever is behind it. The same stack works in both, which is why the output lists them together: one is a photo treatment, the other is glass.

Does the order of the functions matter?+

Very much. Each one takes the result of the last, so blur then contrast is not contrast then blur. The order here is the order they are written in.

Is a filter expensive?+

Blur is, especially as a backdrop over a scrolling area, since it repaints continuously. The rest are cheap. Keep a heavy blur off anything that moves every frame.

Related tools

The tools are free. So is most of the library.

1935 blocks and 989 pieces for shadcn/ui and Tailwind, built on the same tokens these tools write. Install one with a command and the code is yours.

No signup for the tools. MIT for free blocks, commercial licence for Pro.

Markdown version