Back to the library

Legible — texture, not just hue

Variant: Texture stack

A stacked bar of CI minutes by runner where each segment carries a texture as well as a tone — solid, diagonal stripe, dot — separated by 2px ivory gaps, so the breakdown survives greyscale, print and colour-vision deficiency without a legend to cross-reference. One pen crosses the whole bar at a single linear rate over 960ms, so each runner is on screen for a time proportional to its share; easing would make the first segment look bigger than it is. Segments take exactly their share — no padding, chips out of flow — and each name lands on a paper chip as the pen passes its segment’s far edge, at 58%, 88% and 100% of the sweep; the chips keep the type at full contrast whatever texture is behind it. Windows, at 12%, is too narrow for its own name, so rather than shrinking the type until it fits, it steps out under the bar on a leader. Under reduced motion the bar is shown whole and the names still cut in, in order, on a slower clock. Use it for any part-to-whole bar where the categories would otherwise be told apart by colour alone.

datachartaccessibilityentranceclip-pathloop

The source

A complete HTML document. Paste it into an empty .html file and it plays — no stylesheet, script, font, or image to fetch.

<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>Legible — texture, not just hue</title>
    <style>
      :root {
        /* Neutrals — fixed, never remixed. */
        --ivory: #faf9f5;
        --paper: #ffffff;
        --oat: #e3dacc;
        --slate: #141413;

        /* Knobs — the remix API. A knob exists iff declared here and used below. */
        --hue: 38.8;
        --lift: 0;
        --chroma: 1;
        --round: 1;
        --speed: 1;

        /* Accents — derived from the knobs with the family's offsets baked in,
           so one hue roll moves them together. Defaults reproduce the original hex. */
        --clay: oklch(calc(0.6724 + var(--lift)) calc(0.1308 * var(--chroma)) var(--hue));
        --clay-d: oklch(calc(0.5797 + var(--lift)) calc(0.127 * var(--chroma)) var(--hue));
        --olive: oklch(
          calc(0.6118 + var(--lift)) calc(0.0713 * var(--chroma)) calc(var(--hue) + 88.3)
        );
        --rust: oklch(
          calc(0.5408 + var(--lift)) calc(0.1357 * var(--chroma)) calc(var(--hue) - 10.3)
        );

        --_muted: color-mix(in srgb, var(--slate) 62%, transparent);
        --_wash: color-mix(in srgb, var(--clay) 16%, var(--paper));
        --_dot: color-mix(in srgb, var(--slate) 72%, transparent);
        --_rule: color-mix(in srgb, var(--slate) 40%, transparent);

        /* Clock — 5.6s: a frame, a 960ms pen across the bar, then the
           breakdown held long enough to be read. */
        --cycle: 5.6s;
        --t: calc(var(--cycle) / var(--speed));

        --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
      }

      * {
        box-sizing: border-box;
        margin: 0;
        padding: 0;
      }

      body {
        min-height: 100vh;
        display: grid;
        place-items: center;
        background: var(--ivory);
        font-family:
          system-ui,
          -apple-system,
          'Segoe UI',
          Roboto,
          sans-serif;
        color: var(--slate);
      }

      .card {
        width: min(300px, 92vw);
        display: grid;
        gap: 10px;
        animation: frame var(--t) infinite;
      }

      .head {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 8px;
      }

      .label {
        font-size: clamp(11px, 3.4vw, 12px);
        font-weight: 600;
        letter-spacing: 0.12em;
        text-transform: uppercase;
        color: var(--_muted);
      }

      .total {
        font-size: 13px;
        font-weight: 600;
        font-variant-numeric: tabular-nums;
      }

      /* One pen across the whole bar at one rate, so each runner is on screen
         for a time proportional to its share. Linear for the same reason a
         time axis is: easing would make the first segment look bigger. */
      .bar {
        display: flex;
        gap: 2px;
        height: 40px;
        border-radius: calc(6px * var(--round));
        overflow: hidden;
        animation: wipe var(--t) linear infinite;
      }

      /* No padding and min-width: 0, so flex hands out exactly 58 / 30 / 12
         of the space — a chip must never push its own segment wider than
         its share. Chips are taken out of flow; the flex container still
         centres them vertically. */
      .seg {
        position: relative;
        min-width: 0;
        display: flex;
        align-items: center;
      }

      /* Three fills a greyscale print can still tell apart: solid, stripe,
         dot. The 2px gaps are ivory, so a boundary is visible even where two
         textures share a tone. */
      .linux {
        flex: 58;
        background: var(--clay);
      }

      .mac {
        flex: 30;
        background: repeating-linear-gradient(135deg, var(--clay-d) 0 2px, var(--_wash) 2px 6px);
      }

      .win {
        flex: 12;
        background:
          radial-gradient(circle, var(--_dot) 1.1px, transparent 1.5px) 0 0 / 5px 5px,
          var(--paper);
        box-shadow: inset 0 0 0 1px var(--oat);
      }

      /* Labels sit on paper chips, never directly on a texture, so the type
         keeps its full contrast whatever is behind it. */
      .chip {
        font-size: clamp(11.5px, 3.7vw, 12px);
        font-weight: 600;
        font-variant-numeric: tabular-nums;
        white-space: nowrap;
        background: var(--paper);
        position: absolute;
        left: 3px;
        padding: 2px 5px;
        border-radius: calc(4px * var(--round));
        opacity: 0;
        animation: var(--t) infinite;
      }

      .chip span {
        font-weight: 500;
        color: var(--_muted);
      }

      .c-linux {
        animation-name: land-linux;
      }

      .c-mac {
        animation-name: land-mac;
      }

      /* Twelve percent is too narrow to hold its own name. Rather than shrink
         the type until it fits, it steps outside on a leader — still next to
         its data, still no legend. */
      .below {
        position: relative;
        margin-top: -4px;
        padding-top: 10px;
        display: flex;
        justify-content: flex-end;
        opacity: 0;
        animation: land-win var(--t) infinite;
      }

      .below i {
        position: absolute;
        top: 0;
        right: calc(6% - 0.5px);
        width: 1px;
        height: 8px;
        background: var(--_rule);
      }

      .below .chip {
        position: static;
        opacity: 1;
        animation: none;
        padding: 0;
        background: none;
      }

      @keyframes frame {
        0% {
          opacity: 0;
          animation-timing-function: var(--ease-out);
        }
        4%,
        90% {
          opacity: 1;
          animation-timing-function: var(--ease-out);
        }
        94%,
        100% {
          opacity: 0;
        }
      }

      @keyframes wipe {
        0%,
        6% {
          clip-path: inset(0 100% 0 0);
        }
        23.14%,
        95% {
          clip-path: inset(0 0 0 0);
        }
        96%,
        100% {
          clip-path: inset(0 100% 0 0);
        }
      }

      /* Each name lands as the pen passes its segment's far edge: 58% of
         960ms, 88%, 100%. A label arriving early names a region still empty. */
      @keyframes land-linux {
        0%,
        15.94% {
          opacity: 0;
          transform: translateY(3px);
          animation-timing-function: var(--ease-out);
        }
        19%,
        95% {
          opacity: 1;
          transform: translateY(0);
        }
        96%,
        100% {
          opacity: 0;
        }
      }

      @keyframes land-mac {
        0%,
        21.09% {
          opacity: 0;
          transform: translateY(3px);
          animation-timing-function: var(--ease-out);
        }
        24.2%,
        95% {
          opacity: 1;
          transform: translateY(0);
        }
        96%,
        100% {
          opacity: 0;
        }
      }

      @keyframes land-win {
        0%,
        23.14% {
          opacity: 0;
          transform: translateY(-3px);
          animation-timing-function: var(--ease-out);
        }
        26.3%,
        95% {
          opacity: 1;
          transform: translateY(0);
        }
        96%,
        100% {
          opacity: 0;
        }
      }

      @media (prefers-reduced-motion: reduce) {
        /* The pen goes and the bar is shown whole; the names still arrive in
           order, cut rather than slid, on a clock 1.6x slower. */
        .card {
          animation-duration: calc(var(--t) * 1.6);
        }

        .bar {
          animation: none;
        }

        .c-linux,
        .c-mac,
        .below {
          animation-duration: calc(var(--t) * 1.6);
          animation-timing-function: steps(1, end);
        }

        .c-linux {
          animation-name: rm-linux;
        }

        .c-mac {
          animation-name: rm-mac;
        }

        .below {
          animation-name: rm-win;
        }

        @keyframes rm-linux {
          0% {
            opacity: 0;
          }
          15.94% {
            opacity: 1;
          }
          96%,
          100% {
            opacity: 0;
          }
        }

        @keyframes rm-mac {
          0% {
            opacity: 0;
          }
          21.09% {
            opacity: 1;
          }
          96%,
          100% {
            opacity: 0;
          }
        }

        @keyframes rm-win {
          0% {
            opacity: 0;
          }
          23.14% {
            opacity: 1;
          }
          96%,
          100% {
            opacity: 0;
          }
        }
      }
    </style>
  </head>
  <body>
    <div
      class="card"
      role="img"
      aria-label="CI build minutes by runner, 1,240 in total: Linux 58 percent in solid fill, macOS 30 percent in diagonal stripes, Windows 12 percent in dots. Every segment is labelled on the bar itself; there is no colour legend."
    >
      <div class="head">
        <span class="label">Build minutes</span>
        <span class="total">1,240 min</span>
      </div>
      <div class="bar" aria-hidden="true">
        <div class="seg linux">
          <span class="chip c-linux">Linux <span>58%</span></span>
        </div>
        <div class="seg mac">
          <span class="chip c-mac">macOS <span>30%</span></span>
        </div>
        <div class="seg win"></div>
      </div>
      <div class="below" aria-hidden="true">
        <i></i>
        <span class="chip">Windows <span>12%</span></span>
      </div>
    </div>
  </body>
</html>

The variant family

Same idea, one axis moved. Compare them side by side before you commit.