One swatch in RGB, HSL, HSV, HWB and OKLab
Use #336699 as a reference to check a color picker, a CSS declaration or a shader. Compare the same swatch in eight notations and find where round-trip errors start.
Summary
| Formats | #336699 |
|---|---|
| HEX | #336699 |
| RGB | rgb(51 102 153) |
| HSL | hsl(210 50% 40%) |
| HSV | hsv(210 66.7% 60%) |
| HWB | hwb(210 20% 40%) |
| OKLAB | oklab(0.4993 -0.033 -0.093) |
| OKLCH | oklch(0.4993 0.0987 250.43) |
| GLSL · sRGB | vec3(0.2, 0.4, 0.6) |
Read the RGB channels
33, 66 and 99 are hexadecimal. They equal 51, 102 and 153 in decimal. Dividing each by 255 gives the encoded sRGB channels 0.2, 0.4 and 0.6. A shader that expects linear light needs a separate transfer-function conversion.
Check the picker’s model
HSL lightness is halfway between the smallest and largest channels (40%). HSV value is the largest channel (60%). HWB uses the smallest channel for whiteness (20%) and one minus the largest for blackness (40%). Entering an HSV value in an HSL field changes the color.
Check the round trip
Convert the OKLCH value back to RGB and keep enough decimal places to recover 51, 102, 153. Generating a harmony intentionally changes hue. A different swatch after rotating hue is expected.
Tools featured in this guide
Related formats
Frequently asked questions
Can I paste HSV directly into CSS?
Use HSV in a picker that supports it. Write the CSS declaration as HEX, rgb(), hsl(), hwb(), oklab() or oklch().
Authoritative Specifications & References
More color guides
- Fix a muddy CSS gradient midpointCompare a CSS gradient midpoint in sRGB, OKLab and OKLCH using the same two stops. Choose a hue path or add a middle stop to control the transition.
- Hex to OKLCH: Migrating Design Tokens to Tailwind CSS v4Step-by-step guide to upgrading Hex and HSL Tailwind v3 themes into CSS Color 4 @theme oklch() scales with perceptual brightness and Display P3 support.
- OKLCH vs HSL vs sRGB: Understanding Wide-Gamut Display P3Compare HSL, sRGB Hex, Display P3, and OKLCH across perceptual lightness, gradient dead zones, gamut volume, and CSS progressive enhancement.
- WCAG 2.2 Contrast Ratio vs APCA (Lc): Complete Color GuideCompare WCAG 2.2 relative luminance ratios (4.5:1) against modern APCA perceptual lightness contrast (Lc 60/75/90), dark-mode polarity, and CVD.