<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: ecgang</title>
    <description>The latest articles on DEV Community by ecgang (@ecgang).</description>
    <link>https://dev.to/ecgang</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4048143%2Fab606360-278b-4bfb-aa8f-20e156855f3a.jpg</url>
      <title>DEV Community: ecgang</title>
      <link>https://dev.to/ecgang</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ecgang"/>
    <language>en</language>
    <item>
      <title>Halftone UI: a component library that ships its own printing press</title>
      <dc:creator>ecgang</dc:creator>
      <pubDate>Sun, 26 Jul 2026 16:17:02 +0000</pubDate>
      <link>https://dev.to/ecgang/halftone-ui-a-component-library-that-ships-its-own-printing-press-3k7e</link>
      <guid>https://dev.to/ecgang/halftone-ui-a-component-library-that-ships-its-own-printing-press-3k7e</guid>
      <description>&lt;h1&gt;
  
  
  Halftone UI: a component library that ships its own printing press
&lt;/h1&gt;

&lt;p&gt;Most UI libraries paint.&lt;/p&gt;

&lt;p&gt;A background is a hex value. A gradient is a CSS function. A chart is an SVG path. The result is clean, predictable, and often a little too familiar.&lt;/p&gt;

&lt;p&gt;Halftone UI takes a different route: it prints.&lt;/p&gt;

&lt;p&gt;Every visual surface is a live canvas. A component provides a tone function — how dark should the ink be at this point? — and the press keeps the dots that tone can reach.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;meter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;surface&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;tone&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;W&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nx"&gt;W&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mf"&gt;0.72&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="mf"&gt;0.95&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.05&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="na"&gt;pattern&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hatch&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That threshold operation is the whole idea behind halftone UI. It works for a button, a meter, a chart, a photo, or a full-page example.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fewuy6eu990ko1d0ur04s.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fewuy6eu990ko1d0ur04s.jpeg" alt="Halftone UI pie chart and image primitive rendered with layered ink plates" width="800" height="598"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;A pie chart and an image, both printed by the same engine.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The grain is the motion
&lt;/h2&gt;

&lt;p&gt;The dots come from a seeded Poisson-disk cloud: blue noise, similar to the point distribution used in stochastic screening. Each point carries its own threshold. When the tone changes, the dots re-test themselves.&lt;/p&gt;

&lt;p&gt;That makes animation feel different. The UI does not tween a CSS fill from one color to another. The grain itself moves as the press re-evaluates the field.&lt;/p&gt;

&lt;p&gt;The seed is deterministic, so a reload produces the same print. Press “reroll” and the whole page reprints from a new seed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Four screens, one engine
&lt;/h2&gt;

&lt;p&gt;The library ships with four screens:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;hatch&lt;/code&gt; — crosshatch, and the default&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;stipple&lt;/code&gt; — stochastic/FM screening&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;lines&lt;/code&gt; — a line screen&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;waves&lt;/code&gt; — a warped line screen&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Every demo has a live screen picker. Change the screen and the character of the page changes, while the underlying tone field stays the same.&lt;/p&gt;

&lt;p&gt;There is also a real four-plate press: cyan, magenta, yellow, and key, separated at process screen angles with adjustable misregistration. The slightly imperfect overlap is part of the result.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fv9jd07354wy7pdw4pf2k.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fv9jd07354wy7pdw4pf2k.jpeg" alt="Halftone UI line chart rendered in dark mode" width="800" height="598"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The same tone-field approach works for charts, not just decorative surfaces.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Copy the code, own the result
&lt;/h2&gt;

&lt;p&gt;Halftone UI is intentionally not an npm package. The source is meant to be copied into your project, in the same spirit as shadcn-style libraries.&lt;/p&gt;

&lt;p&gt;The core has no runtime dependencies. React and Vue adapters sit beside it and import the same core engine.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;HalftoneProvider&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Surface&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./halftone/react/index.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;App&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;HalftoneProvider&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Surface&lt;/span&gt;
        &lt;span class="na"&gt;field&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;u&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;v&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mf"&gt;0.6&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
        &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;160&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;HalftoneProvider&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The adapter keeps the real DOM underneath the ink: buttons are buttons, meters are &lt;code&gt;&amp;lt;progress&amp;gt;&lt;/code&gt;, and charts expose tables with captions. The canvas is decoration; the semantics remain inspectable.&lt;/p&gt;

&lt;h2&gt;
  
  
  There is a docs page for every weird edge
&lt;/h2&gt;

&lt;p&gt;The site contains 88 documented sections: primitives, charts, sign-in flows, dashboards, pricing pages, dialogs, menus, comboboxes, OTP fields, image halftoning, and Smudge — the resident ink imp.&lt;/p&gt;

&lt;p&gt;The whole thing is designed to be played with. Open the docs, change the grain, rotate the hue wheel, switch themes, and watch the same press redraw every mounted surface.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fr2kr398gskdc02i7ysey.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fr2kr398gskdc02i7ysey.jpeg" alt="Smudge, the Halftone UI ink imp" width="800" height="598"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Even the mascot is pressed from the same halftone engine.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Try it here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://halftone-ui.com/" rel="noopener noreferrer"&gt;Halftone UI&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://halftone-ui.com/docs/" rel="noopener noreferrer"&gt;Docs and live demos&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://halftone-ui.com/studio/" rel="noopener noreferrer"&gt;Studio&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/ecgang/halftone-ui" rel="noopener noreferrer"&gt;Source on GitHub&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Halftone UI is MIT licensed. No dependencies. No build step for the standalone version. Just a small press, a seeded cloud of dots, and a tone field waiting to be inked.&lt;/p&gt;

</description>
      <category>webcomponents</category>
      <category>designsystem</category>
      <category>uiux</category>
      <category>uidesign</category>
    </item>
  </channel>
</rss>
