Build a stepped color ramp with predictable endpoints
Admin ·
A chart legend often needs a handful of distinct swatches. Select both ends first, then use the swatch count to control how many steps a reader sees.
Check the middle of a three-step ramp
Enter #000000, choose White (tints) and set three swatches. The values are #000000, #808080 and #FFFFFF. Halfway between the encoded channel values 0 and 255 is 127.5, which rounds to 128.
Fade a colored endpoint to transparency
Choose a custom endpoint. Start with opaque red and end with rgba(0, 0, 255, 0). The middle red has alpha 0.5. The fully transparent blue contributes no visible blue to this midpoint because RGB channels are weighted by alpha before mixing.
Keep the ends when changing the count
Two swatches give just the endpoints. Five place a swatch at 25%, 50% and 75% between them. Choose Black (shades) to build darker variants while preserving the base alpha.
Choose steps for a legend with five intervals
A scale with five swatches contains both endpoints and three interior colors. Use six swatches if your drawing needs six boundary colors around five transitions. Write out how a numeric value is assigned to an interval before applying the swatches.
For a chart with a meaningful zero, decide whether zero should sit at an endpoint or in the middle. A single ramp between two endpoints does not know where the data’s neutral point is.
Common questions
Does the ramp include both input colors?
Yes. The first and last swatches correspond to your endpoints even when you change the count.
Can every step be used for readable text?
Test each foreground and background pair, including its opacity and the canvas underneath. Step spacing alone does not establish readability.