What is Color Converter & Picker?
How It Works
Enter a colour value in any format (HEX, RGB, or HSL) or use the colour picker. All three formats update in real time. The WCAG section shows contrast ratios against white and black backgrounds with pass/fail indicators for AA and AAA levels. The palette section generates related colours based on colour theory. Click any palette swatch to set it as the active colour.
Formula
HEX to RGB: Parse hex pairs โ convert to decimal (0-255) RGB to HSL: Normalize to 0-1 โ calculate hue from max channel โ saturation from chroma โ lightness from average of max and min HSL to RGB: Calculate chroma from saturation and lightness โ map hue to RGB channels
Formula Explained
HEX is base-16 representation of RGB values. Each pair of hex digits maps to one RGB channel (00-FF โ 0-255). HSL conversion uses the standard sRGB colour space formulas. Hue is determined by which RGB channel is dominant, saturation by the difference between the strongest and weakest channels, and lightness by the average of the strongest and weakest. WCAG contrast uses relative luminance: L = 0.2126R + 0.7152G + 0.0722B (with gamma correction).
Example
HEX: #3B82F6 RGB: rgb(59, 130, 246) HSL: hsl(217, 91%, 60%) Contrast vs white: 3.44:1 (AA Large: Pass, AA: Fail) Contrast vs black: 6.11:1 (AA: Pass, AAA Large: Pass) Complementary: hsl(37, 91%, 60%) = #F6A83B Triadic: hsl(337, 91%, 60%) and hsl(97, 91%, 60%)
Tips & Best Practices
- โUse WCAG contrast checking to ensure your text colours are accessible.
- โHSL is the most intuitive format for adjusting colours โ change lightness for shades.
- โUse complementary colours for call-to-action buttons against your primary colour.
- โSave your brand colours by bookmarking the URL with your hex code.
- โFor dark mode, increase lightness (L in HSL) by 20-30% while keeping hue and saturation.
Common Use Cases
- โขConverting brand colours between HEX, RGB, and HSL for CSS
- โขChecking colour accessibility compliance for WCAG standards
- โขGenerating harmonious colour palettes for web design
- โขFinding complementary and triadic colours for UI design
- โขCreating consistent colour shades for design systems