Documentation

  • 311 sections
  • Solid
  • Tailwind or StyleX

Every component draws on canvas through the same ordered-dither engine. Compose charts from parts, or drop in a single primitive.

Quick start

The kit is a folder, not a package. Copy dither-kit/ from the GitHub repo (opens in a new tab), install four small runtime deps and alias it. You already have Solid, and Tailwind if you use it.

  1. Copy the kit folder straight from the repo

    degit grabs just the folder

    npx degit drvova/dither-ui/packages/dither-kit/src src/dither-kit
  2. Install the runtime deps

    you already have Solid, and Tailwind if you use it

    npm i d3-scale d3-shape clsx tailwind-merge
  3. Alias @dither-kit so imports stay clean

    // vite.config.ts
    resolve: { alias: { "@dither-kit": "/src/dither-kit/solid" } }
    
    // tsconfig.json, under compilerOptions
    "paths": { "@dither-kit": ["./src/dither-kit/solid"] }
  4. Use it

    import { AreaChart, Area, DitherButton } from "@dither-kit"

Without Tailwind

The kit brings its own stylesheet, in cascade layers so your styles win. Pick your system in the header and every snippet here, every Studio export and the agent's code.get come out as a scoped stylesheet, CSS Modules or StyleX.

<!-- No Tailwind? One plain stylesheet: the tokens, a base scoped to
     .dither-kit and every class the components use. -->
<link rel="stylesheet" href="https://dither-ui.com/kit/dither-kit.css">

<div class="dither-kit">
  <DitherButton class="cta">Ship</DitherButton>
</div>

The tokens are plain custom properties, so theme from CSS, JS or any vars contract:

import { applyTheme, themeCss } from "@dither-kit"

applyTheme({ accent: "#3f8ff3", radius: "4px" })  // on <html>, returns the undo
themeCss({ background: "#000" }, ".dark")          // a rule for your stylesheet

Prefer to read the source first? Every component lives under dither-kit/ (opens in a new tab). No build step, no black box.

Engine

The parts under every surface, each named once: what it does in one line, and a figure read from the kit's own source.

Matrix
Each cell compares its tone with one rank of a 4×4 threshold matrix and lights when the tone passes it, so a flat fill becomes a pattern of lit and unlit cells. Print screens
16 ranks, 17 tones
Screens
The matrix is Bayer's unless a DitherScreen around a surface picks a printer's line, diagonal, dot or cross; a fill that carries a label keeps Bayer, so its letters hold. Print screens
5 screens
Seeds
One integer seeds the matrix's jitter, the texture, the bloom and the easing, so the same seed draws the same surface every time. Seeds
1 integer
Palette
One table resolves each hue to the fill, line and star colours every surface paints with, and the theme's swatches mirror it. Palette
7 hues
Clock
One clock drives every animation; held at a moment, every surface paints that moment, and the same moment gives the same bytes. Stage
0 frames while held
Wipe
Reveals and page transitions are ordered-dither masks: a cell shows once the sweep passes its rank in an 8×8 matrix, so a wipe has a dithered front, never a soft edge. Dither reveal
64 ranks
World
Model files parse in the page and rasterize on the CPU byte for byte, or on WebGL for big meshes, into the same dither pass. World (3D)
8 formats
Shader
GLSL compiles offscreen at the cell resolution and its pixels are read back and dithered; iTime is the kit's clock, and other surfaces bind as its inputs. Shader (GLSL)
4 inputs

Verification

The kit's claims, measured with its own engine in the browser reading this page: what each one claims, how it is measured and against what, then the reading. CI takes the same readings on every push, and each claim links the test that holds it.

Measured in your browser when this section comes into view.

Same seed, same moment, same bytes
The poster is printed twice at seed 5 and 2.4 s and every byte compared; printed again at 3.4 s, the control must differ. Its test: Same seed, same moment, same bytes (opens in a new tab)
not yet measured
against 0 bytes differ
The same bytes in every engine
The same print is hashed through the kit's FNV-1a and set beside the hash CI recorded running the kit in Node. Its test: The same bytes in every engine (opens in a new tab)
not yet measured
against hash c8364f4f
Every screen prints 17 tones
Each screen's 4×4 thresholds are set against 17 even tone steps by the rule every surface prints with, a cell lighting when the tone passes its threshold, and the lit cells counted. Its test: Every screen prints 17 tones (opens in a new tab)
not yet measured
against step k lights k cells
The 3D engine repeats itself byte for byte
A box read from a VRML file is rasterized twice on the CPU at one view and every byte compared; turned 15°, the control must differ. Its test: The 3D engine repeats itself byte for byte (opens in a new tab)
not yet measured
against 0 bytes differ
A scene scales exactly with its box
A track of container units and percentages is sampled at 0.7 s and resolved in a 320 by 180 box, then in one twice that size. Its test: A scene scales exactly with its box (opens in a new tab)
not yet measured
against every length doubles
A wipe shows one more cell per step
The dissolve's mask is drawn at each of the 64 steps of its 8×8 matrix and its shown cells compared step to step. Its test: A wipe shows one more cell per step (opens in a new tab)
not yet measured
against one more each step
8 model formats read in the page
A triangle written in each format (a Gaussian in the capture's) is parsed by the kit's own readers, here, with nothing fetched. Its test: 8 model formats read in the page (opens in a new tab)
not yet measured
against a triangle or a Gaussian from each
The landing's inks hold their contrast as printed
Bone, muted bone and the ember are printed through the Bayer matrix on the obsidian at full and half tone, and each patch is measured from its pixels in linear light. Its test: The landing's inks hold their contrast as printed (opens in a new tab)
not yet measured
against 4.5:1 full, 3:1 at half