Color guides

Convert one translucent swatch between color models

·

A design file may give you HSV while a stylesheet uses HSL. First identify which model supplied the numbers. At the same hue and saturation, brightness in HSV and lightness in HSL can describe visibly different swatches.

CSS Color Format Converter

Start with a blue swatch

Enter rgba(51, 102, 153, 0.5). HEX8 gives #33669980 and HSL gives hsl(210 50% 40% / 0.5). In HEX8 the last byte represents 128/255, slightly more than one half. Copy the functional notation to keep the original 0.5.

W3C CSS Color Module Level 4

Read the RGB extrema as HWB

The smallest RGB channel is 51/255, giving 20% whiteness. The largest is 153/255, giving 40% blackness. Enter hwb(210 20% 40% / 0.5) to recover the starting swatch. When whiteness and blackness sum to at least 100%, their ratio determines a gray.

W3C CSS Color Module Level 4

Use the HSV readout in a design tool

The largest channel sets value to 60%. Saturation is the difference between the largest and smallest channels divided by the largest, about 66.667%. Paste hsv(210 66.667% 60% / 0.5) into this converter. Use its RGB, HSL, HWB or HEX output when writing a stylesheet.

Round-trip an accent with partial opacity

The last byte of #33669980 is hexadecimal 80, or 128 decimal. If a design system uses opacity as a percentage, dividing by 255 gives about 50.2%. Rounding to 50% can still return the same 8-bit alpha after another conversion.

Compare the rendered accent on the same background before comparing screenshots. A translucent color over white and the same value over gray can look different even when both converters agree on the channels.

Common questions

Why does a gray swatch show hue zero?

All three RGB channels are equal. Any hue produces the same gray at zero saturation, so the conversion displays zero.

How can I get eight digits for an opaque color?

Copy HEX8. It always includes the alpha byte, which is FF at full opacity.

Sources

Put it into practice.

Related guides