Dither effect in React: free shaders for images, logos, gradients and text

What a dither effect is, how ordered, blue-noise and error-diffusion dithering differ, and 4 free React components that dither images, logos, gradients and headlines on the GPU.

Dither Image component: a photo rendered with Bayer dithering in two inks

Key takeaways

  • Dithering fakes more tones than you have by arranging a few colors in a pattern.
  • Ordered (Bayer) dithering gives a crisp grid, blue noise looks organic, error diffusion follows detail.
  • 4 free React components dither images, logos, gradients and text in WebGL, with CSS fallbacks.

A dither effect renders an image with only a few colors by arranging them in a pattern, so your eye mixes them into tones that are not really there. It started as a way to show photos on screens with tiny palettes. Today it is a deliberate look: printed, tactile and a little retro, on landing pages, product shots, logos and headlines.

The dither components

  • Dither Image: Dither shader for images: Bayer and blue-noise dithering to 2 to 4 inks, with a cursor loupe that sharpens, inverts or reveals.
  • Dither Logo: Dither logo effect in React: your mark as ordered-dither stipple dots that scatter from the cursor and spring back.
  • Dither Gradient: Dithered mesh gradient background: a slow flowing gradient through Bayer dithering, with a cursor-following light pool.
  • Dither Text: Dither text effect: headlines printed as a Bayer halftone that inks in as you scroll into view and dissolves as it leaves.

All 4 run on the GPU with WebGL2 and fall back to WebGL1. Without WebGL each one shows a CSS fallback (a halftone gradient, a dotted mask), so the page never breaks. They have zero dependencies besides React.

How dithering works

Every dithering method answers the same question: this pixel is 40% bright, but I only have black and white, so which one do I draw? The methods differ in how they spread the error.

Ordered dithering (Bayer)

Ordered dithering compares each pixel to a threshold from a small repeating matrix, the Bayer matrix. Below the threshold it gets ink, above it does not. The result is a crisp, regular cross-hatch pattern that reads instantly as "dithered". Because each pixel only needs its own position and brightness, it is fast and perfect for a shader.

bayer.js
// 4x4 Bayer matrix, values 0..15
const BAYER4 = [
   0,  8,  2, 10,
  12,  4, 14,  6,
   3, 11,  1,  9,
  15,  7, 13,  5,
];

// A pixel is ink when its brightness is below the threshold
function ink(x, y, brightness /* 0..1 */) {
  const t = (BAYER4[(y % 4) * 4 + (x % 4)] + 0.5) / 16;
  return brightness < t;
}

Blue-noise dithering

Blue noise uses a threshold texture with no visible repetition. Dots spread evenly without forming a grid, so the image looks more like film grain or a fine print. It is also position-based, so it runs as fast as Bayer.

Error diffusion (Floyd-Steinberg)

Error diffusion rounds each pixel to the nearest color and pushes the rounding error onto its neighbors. It follows detail very well, but each pixel depends on the ones before it, which makes it harder to run in parallel on a GPU.

Where a dither effect works

  • Hero images and product shots with two to four inks: Dither Image adds a cursor loupe that sharpens, inverts or reveals the original.
  • Logos as interactive stipple: Dither Logo scatters the dots from the cursor and springs them back.
  • Backgrounds: Dither Gradient runs a slow mesh gradient through Bayer dithering with a light pool that follows the cursor.
  • Editorial headlines: Dither Text prints a headline as a halftone that inks in on scroll.

Pair dithering with a matching design system

Dithering looks best when the rest of the page agrees with it: paper tones, a limited palette, honest type. The Risograph Press system (riso blue and fluorescent pink on uncoated paper) and Null Grid (Swiss black and white on a visible grid) are good matches. The glossary explains the related styles: risograph, duotone and grainy gradients.

Install a dither component

Each component is a shadcn-compatible registry item:

npx shadcn@latest add freedesignmd.com/r/dither-image.json

Or open the component page and copy the file. For chrome instead of ink, the same library has liquid metal shaders.

Frequently asked questions

A way to show more tones than you have colors by arranging a few colors in a pattern, so the eye mixes them. Used today as a deliberate printed, retro look for images, logos, gradients and type.

Bayer (ordered) dithering compares each pixel to a repeating threshold matrix, giving a crisp regular pattern that is fast on a GPU. Floyd-Steinberg (error diffusion) pushes each pixel's rounding error to its neighbors, which follows detail better but is sequential.

Install a component with npx shadcn@latest add freedesignmd.com/r/dither-image.json, or copy the file from its page. There are components for images, logos, gradients and text, all with WebGL and CSS fallbacks.

Yes. Each component falls back from WebGL2 to WebGL1, and without WebGL it shows a CSS fallback such as a halftone gradient or a dotted mask.
Tammo Elsner, founder of freedesignmd

Written by Tammo Elsner

Founder of freedesignmd, a free DESIGN.md library for AI coding agents. About the project · LinkedIn

Keep reading. More on Shaders and effects.

Liquid Metal shader: flowing silver chrome as a WebGL background

Shaders and effects

Liquid metal effect: free chrome shaders for React

Flowing chrome, mirror headlines and a drop of mercury that reaches for your cursor: 4 free liquid metal components for React, how they work and where the effect fits.

Nov 16, 2026 · 3 min read

Data Table component from the free React component library

Components and templates

Free React components you install with the shadcn CLI

116 free React components in a shadcn-compatible registry. How to install them with one command, what the registry returns, and how every component is tested against its preview.

Nov 16, 2026 · 3 min read

Linear Orbit, one of the DESIGN.md examples: a dark hairline product workspace

DESIGN.md

31 DESIGN.md examples for AI coding agents, by style and industry

Every DESIGN.md example in the freedesignmd library, grouped by style and industry, with what each one is built for. Pick the closest one, copy it, change the brand color.

Nov 16, 2026 · 8 min read

Start with a free DESIGN.md. Or install a component.

Free design systems, React components and landing page templates for Claude Code, Cursor, Lovable and v0. No signup.