<?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: Gil Barbara</title>
    <description>The latest articles on DEV Community by Gil Barbara (@gilbarbara).</description>
    <link>https://dev.to/gilbarbara</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%2F108308%2F324ee230-baca-4e16-8cee-96b06cb8ed12.jpeg</url>
      <title>DEV Community: Gil Barbara</title>
      <link>https://dev.to/gilbarbara</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gilbarbara"/>
    <language>en</language>
    <item>
      <title>I stopped generating color scales and started shaping them</title>
      <dc:creator>Gil Barbara</dc:creator>
      <pubDate>Tue, 23 Jun 2026 13:53:17 +0000</pubDate>
      <link>https://dev.to/gilbarbara/i-stopped-generating-color-scales-and-started-shaping-them-5ekm</link>
      <guid>https://dev.to/gilbarbara/i-stopped-generating-color-scales-and-started-shaping-them-5ekm</guid>
      <description>&lt;p&gt;Generating a color scale is a solved problem. Hand most tools a color and you get back eleven valid, perceptually even steps. The trouble is they tend to come out a little lifeless: chalky tints, every step interchangeable, technically correct and slightly generic.&lt;/p&gt;

&lt;p&gt;The scale you actually want has &lt;em&gt;intent&lt;/em&gt;: clean highlights, shadows with depth, contrast spent where your UI needs it. The gap between the two isn't more math — it's a few controls, and a way to see what they're doing.&lt;/p&gt;

&lt;p&gt;I maintain a small color library, &lt;a href="https://github.com/gilbarbara/colorizr" rel="noopener noreferrer"&gt;colorizr&lt;/a&gt;, and its &lt;code&gt;scale()&lt;/code&gt; does the generating part: one color in, a full scale out:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&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;scale&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="s1"&gt;colorizr&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nf"&gt;scale&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#ff38af&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// { 50: '#ffeff7', 100: '#ffe2f1', …, 500: '#ff3fb4', …, 950: '#31001c' }&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Even, valid, fine. The interesting part is everything &lt;em&gt;after&lt;/em&gt; the default — the controls that let you shape it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The catch: you'd be shaping blind
&lt;/h2&gt;

&lt;p&gt;Here's why this takes more than an API. Most of these controls are gamut-relative: they work against the maximum chroma a color can physically exhibit, and that ceiling shifts with hue and lightness at every step. There's no fixed range to picture the way there is in HSL — set &lt;code&gt;chromaCurve: { low: 0.6, high: 0.4 }&lt;/code&gt; and you'd have no real idea what you just did.&lt;/p&gt;

&lt;p&gt;So the app isn't a product wrapped around the library, it's a &lt;strong&gt;visualizer&lt;/strong&gt; for it. The scale on screen, every control on a slider, and a chart for the parts you can't see.&lt;/p&gt;

&lt;h2&gt;
  
  
  Chroma curve — shaped against the ceiling
&lt;/h2&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%2Fr3r6vs3s3qyzewbgwr6o.png" 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%2Fr3r6vs3s3qyzewbgwr6o.png" alt="chroma output under the P3 gamut ceiling" width="800" height="319"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nf"&gt;scale&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#ff38af&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;span class="na"&gt;chromaCurve&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;low&lt;/span&gt;&lt;span class="p"&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="na"&gt;high&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.4&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 dotted line is the gamut ceiling; the solid line is what the scale uses. You shape chroma as a &lt;em&gt;fraction of the ceiling&lt;/em&gt;, so the tints stay clean and nothing clips — per step, per hue. Hold chroma flat instead, and those pale steps go chalky. That's the whole difference between a washed-out light end and a clean one, and it's not a number you'd ever land on by eye.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hue shift — depth across the range
&lt;/h2&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%2Fkdx1ogjp7d61sg6s7sqj.png" 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%2Fkdx1ogjp7d61sg6s7sqj.png" alt="an unshifted scale vs hueShift 25 — warmer shadows" width="800" height="279"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nf"&gt;scale&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#ff38af&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;span class="na"&gt;hueShift&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pinning one hue across the whole scale is part of what reads synthetic. Rotate it a few degrees toward the ends — warm the shadows, cool the tints — and the scale gains the sense of light moving through it that hand-mixed palettes have. The middle stays locked to your base; the visualizer shows you how far is too far before your pink drifts into orange.&lt;/p&gt;

&lt;p&gt;There's more in the same spirit: a &lt;strong&gt;lightness curve&lt;/strong&gt; to decide where the contrast lives, a &lt;strong&gt;min/max lightness range&lt;/strong&gt; to set the endpoints, and they all work the same way: a slider and a chart, so the choice is something you see, not something you guess.&lt;/p&gt;

&lt;h2&gt;
  
  
  The payoff
&lt;/h2&gt;

&lt;p&gt;That's the whole loop: shape the scale against the charts until it has the character you want, then take it to code. The visualizer hands you the result, export-ready — CSS variables, Tailwind, SCSS — and if you'd rather skip the UI, the same controls are available in colorizr for your build.&lt;/p&gt;

&lt;p&gt;Same base color across all images above. The numbers won't tell you which scale you want; shaping it where you can see it will.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://github.com/gilbarbara/colorizr" rel="noopener noreferrer"&gt;colorizr&lt;/a&gt;&lt;/strong&gt; - the engine. &lt;code&gt;npm i colorizr&lt;/code&gt;, generate and shape scales in code, export-ready.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://lab.colormeup.co/custom-color-scales" rel="noopener noreferrer"&gt;the visualizer&lt;/a&gt;&lt;/strong&gt; - shape against the gamut ceiling, watch the curves, copy the result out.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>css</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
