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.

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.
// 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

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


