Updated
Halftone
Customize
Colors
Background
Spacing7.0px
Dot size0.95
Min dot0.30
Angle0°
Frequency1.30
Flow1.20
Band width1.00
Contrast1.10
Glow0.50
Softness0.00
Fade0.00
edges
Speed1.0
Seed0
Radius70px
Trail strength0.85
Trail length0.90s
Follow0.55
Installation
npx shadcn@latest add https://uibrik.com/r/halftone.jsonAdd the cn helper
Imports
cnfrom@/lib/utils, whichshadcn initcreates. Add it by hand without shadcn.Copy the source into your project
components/uibrik/halftone/halftone.tsx"use client"; import { ShaderSurface, type ShaderBackgroundProps } from "../_shader-background/ShaderSurface"; // A screen of lit dots showing ribbons of light. The picture underneath is noise warped by noise, // shaped into soft ribbons along its curves, so bright streams swirl slowly through the dark. Every // dot on the grid stays: in the dark it's small and dim, and as the light reaches it, it grows and // brightens along the colour list (blended in OKLCH), like a halftone printed in light. A faint // glow spills around the brightest dots. The pointer leaves an eased trail along its real path. const SHADER = /* glsl */ ` uniform float u_cell; // dot spacing, css px uniform float u_dotSize; // largest dot, as a share of the spacing uniform float u_minDot; // smallest dot, as a share of the largest uniform float u_angle; // grid angle, degrees uniform float u_frequency; // size of the ribbons; higher is busier uniform float u_flow; // how much the ribbons curl uniform float u_bandWidth; // thickness of the ribbons uniform float u_contrast; // tone contrast uniform float u_glow; // light spilling around bright dots uniform float u_softness; // blur on each dot's edge uniform float u_fade; // how much the dots fade out (see u_fadeFrom) uniform float u_fadeFrom; // 0 edges, 1 top, 2 bottom, 3 left, 4 right uniform float u_radius; // width of the pointer trail, css px uniform float u_trailAmt; // how strongly the trail lights the dots
Adds the files to
components/uibrik/halftone. With the @uibrik namespace set up: npx shadcn@latest add @uibrik/halftone.Too large to paste whole, so Copy prompt gives a short prompt that installs it with the CLI. Download the full prompt to attach it instead.
Usage
import { Halftone } from "@/components/uibrik/halftone/halftone";<Halftone colors={["#1b2533", "#5c7a9a", "#c9d6e0", "#f6ecdc"]} background="#050608" spacing={7} dotSize={0.95} minDot={0.3} angle={0} frequency={1.3} flow={1.2} bandWidth={1} contrast={1.1} glow={0.5} softness={0} fade={0} fadeFrom="edges" speed={1} seed={0} animate interactive radius={70} trailStrength={0.85} trailLength={0.9} follow={0.55}> …</Halftone>Where to use Halftone
Print-inspired backgrounds
Swirling ribbons drawn by dot size give a page a newspaper or poster feel.
Pairs with Dither Gradient
Music and event pages
Lit dots in motion suit gig posters, festivals and album sites.
Agency heroes
A graphic, high-contrast pattern fits studios with a bold visual identity.
Props
Halftone- colors
- Type string[]
- ["#1b2533","#5c7a9a","#c9d6e0","#f6ecdc"]
- Dot colours from dim to bright, blended in OKLCH; 2 to 6.
- background
- Type string
- "#050608"
- Colour behind the dots.
- spacing
- Type number
- 7
- Distance between dots.
- dotSize
- Type number
- 0.95
- Largest dot, as a share of the spacing; 1 lets the brightest dots touch.
- minDot
- Type number
- 0.3
- Smallest dot (in the dark), as a share of the largest; 0 lets dark dots vanish.
- angle
- Type number
- 0
- Grid angle.
- frequency
- Type number
- 1.3
- Size of the ribbons of light; higher is busier.
- flow
- Type number
- 1.2
- How much the ribbons curl.
- bandWidth
- Type number
- 1
- Thickness of the ribbons.
- contrast
- Type number
- 1.1
- Higher gives darker darks and fuller lights.
- glow
- Type number
- 0.5
- Light spilling around the brightest dots.
- softness
- Type number
- 0
- Blur on each dot's edge.
- fade
- Type number
- 0
- How much the dots fade out toward the chosen side.
- fadeFrom
- Type "edges" | "top" | "bottom" | "left" | "right"
- "edges"
- Where the dots fade out.
- speed
- Type number
- 1
- Animation speed; 1 is the designed pace.
- seed
- Type number
- 0
- Shifts the composition, so two backgrounds with the same settings still differ.
- animate
- Type boolean
- true
- Move on its own. Off draws one still frame.
- interactive
- Type boolean
- true
- React to the pointer.
- radius
- Type number
- 70
- Width of the pointer trail.
- trailStrength
- Type number
- 0.85
- How strongly the trail lights the dots.
- trailLength
- Type number
- 0.9
- Seconds the trail takes to fade.
- follow
- Type number
- 0.55
- How lazily the trail follows the pointer, 0 (locked) to 1 (drifts after it).
- children
- Type ReactNode
- –
- Content shown on top of the background.
- className
- Type string
- –
- Classes for the box; it fills whatever size you give it.