About
Print an image or a moving pattern as dots, lines, or four overlapping inks.
Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Halftone to your project and fits it to your theme.
Code
How Halftone is used: the demo's code. The component's own source comes with a free account.
Usage.tsx
"use client";
import { Halftone, type HalftoneMode, type HalftoneShape } from "@/components/ui/honest-halftone";
const sources = [
{ label: "Procedural field", value: "procedural", src: undefined, alt: undefined },
{
label: "Alpine dusk",
value: "alpine",
src: "https://cdn.21st.dev/assets/mirror/2f/2f0f4f8872c14bf6371a864f07ab79be9bb0a7892731b3c5e14ddbb9354c5095.jpg",
alt: "An alpine lake reflecting an orange sunset between dark mountain ridges.",
},
{
label: "Color-blocked city",
value: "city",
src: "https://cdn.21st.dev/assets/mirror/9b/9b9e207a9a5933104f1dbbde76c43fc4fd1e77104cd3924ca04e217feb9bcee7.jpg",
alt: "Blue and orange apartment buildings against a clear sky.",
},
] as const;
interface HalftoneSettings {
source: string;
mode: HalftoneMode;
shape: HalftoneShape;
cellSize: number;
angle: number;
dotScale: number;
contrast: number;
brightness: number;
roughness: number;
inkColor: string;
paperColor: string;
animated: boolean;
}
const defaults: HalftoneSettings = {
source: "procedural",
mode: "mono",
shape: "circle",
cellSize: 8,
angle: 45,
dotScale: 1,
contrast: 1.1,
brightness: 0,
roughness: 0.15,
inkColor: "#16181d",
paperColor: "#f4f1ea",
animated: true,
};
export default function HalftoneDemo() {
const settings = defaults;
const source = sources.find((item) => item.value === settings.source) ?? sources[0];
const { source: _source, ...props } = settings;
void _source;
return (
<div className="flex min-h-[420px] w-full items-center justify-center p-6">
<div className="h-80 w-full max-w-xl overflow-hidden rounded-xl">
{source.src ? (
<Halftone className="size-full" src={source.src} alt={source.alt} {...props} />
) : (
<Halftone className="size-full" {...props} />
)}
</div>
</div>
);
}
















