🦃 Thanksgiving pricing is live: save $50 on Starwind Pro lifetime access.

Halftone Dots

Free

Redraws an image as halftone dots with square or hex grids, four dot styles, and optional image colors. Adapted from Halftone Dots by Paper Shaders (shaders.paper.design) under the Apache 2.0 license.

Upgrade to Pro
Red sandstone buttes across a desert valley
Loading code...

Starwind Dependencies

Sign in to view code and copy install commands.

Sign in

This component requires Starwind Pro.

Get lifetime access to all premium components, updates, and priority support.

Upgrade to Pro

Failed to load code. Please try again.

Code

Usage
<ShaderHalftoneDots
  backgroundColor="#f2f1e8"
  dotColor="#2b2b2b"
  dotStyle="gooey"
  gridType="hex"
  imageSrc="https://images.unsplash.com/photo-1509316785289-025f5b846b35?w=1600&h=1200&fit=crop"
  imageContrast={0.4}
  dotRadius={1.25}
  edgeGrain={0.2}
  grainOverlay={0.2}
  grainSize={0.5}
  gridSize={0.5}
  useImageColors={false}
  invertLuminance={false}
  graphicScale={1}
  graphicRotation={0}
  graphicOffsetX={0}
  graphicOffsetY={0}
/>

Props

proptypedefaultdescription
imageSrc string required Image URL. The URL must be same-origin or served with CORS headers.
imageAlt string required Alternative text for the image. Pass an empty string for a decorative image.
imageWidth number 1600 Image width in pixels. Sets the aspect ratio with imageHeight. Defaults to 1600.
imageHeight number 1200 Image height in pixels. Sets the aspect ratio with imageWidth. Defaults to 1200.
backgroundColor string #f2f1e8 Color behind the dots. Accepts any CSS color.
dotColor string #2b2b2b Dot color. Needs image colors off. Accepts any CSS color.
useImageColors boolean false Color each dot with the image color under it.
dotStyle "classic" | "gooey" | "holes" | "soft" gooey Style of each dot.
invertLuminance boolean false Invert the image brightness. Needs contrast above 0.
gridType "square" | "hex" hex Layout of the dot grid.
gridSize number 0.5 Size of the grid cells. Range 0 to 1.
dotRadius number 1.25 Largest dot size, relative to a grid cell. Range 0 to 2.
imageContrast number 0.4 Contrast of the sampled image. At 0 all dots get the same size. Range 0 to 1.
edgeGrain number 0.2 Grain that breaks up the dot edges. Range 0 to 1.
grainOverlay number 0.2 Black and white grain added over the result. Range 0 to 1.
grainSize number 0.5 Size of the edge grain and the grain overlay. Range 0 to 1.
graphicScale number 1 Overall zoom level of the graphic.
graphicRotation number 0 Rotation of the graphic in degrees.
graphicOffsetX number 0 Horizontal offset of the graphic center.
graphicOffsetY number 0 Vertical offset of the graphic center.
graphicFit "none" | "contain" | "cover" cover How the graphic fits the box.
opacity number 1 Sets the opacity of the whole block, including the fallback image.
maxDpr number 1.5 Caps device pixel ratio for sharper output without runaway GPU cost.