🎨 Design & Developer Guide

Color Picker Guide: HEX, RGB & HSL Codes Explained for Designers & Developers (2026)

📅 June 2026⏱ 9 min read✍️ ToolLoom Editorial

Every designer has stared at a colour and wondered what its HEX code is. Every developer has copied a colour from Figma and forgotten how to adjust its lightness in CSS. This guide explains colour formats — HEX, RGB, HSL — how to convert between them, how to pick accessible colour combinations, and how to build palettes that work for Indian digital audiences.

📋 In This Article
  1. HEX, RGB, HSL — what each format means
  2. When to use which colour format
  3. How to convert between colour formats
  4. Colour accessibility — contrast ratios & WCAG
  5. Building colour palettes — harmony rules
  6. Colour in Indian UI/UX design
  7. Using colour codes in CSS & Tailwind
  8. 5 common colour mistakes designers make
  9. Frequently asked questions

HEX, RGB, HSL — What Each Format Means

All three formats describe the same colour — they are just different ways to express it. Here is the same red-orange colour in all three:

HEX
#FF5733
6-digit hex code. Most common for web design, Figma, CSS stylesheets, and brand guides.
RGB
rgb(255, 87, 51)
Red, Green, Blue channels — each 0–255. Easy to understand colour mixing. Used in CSS, Android, Flutter.
HSL
hsl(11, 100%, 60%)
Hue (angle 0–360°), Saturation, Lightness. Most intuitive for designers adjusting tones and building palettes.

Understanding HEX codes

A HEX code is six hexadecimal digits (0–9, A–F) split into three pairs — RR GG BB. Each pair represents one colour channel from 00 (none) to FF (full). So #FF0000 is pure red (R=255, G=0, B=0), #00FF00 is pure green, and #000000 is black (all channels zero). The shorthand 3-digit HEX (#F53) expands each digit — #FF5533.

Understanding HSL — the designer's format

HSL is the most intuitive format for making design decisions. Hue is the pure colour — a position on the colour wheel from 0° (red) to 360° (back to red), with green at 120° and blue at 240°. Saturation controls intensity — 0% is grey, 100% is fully vivid. Lightness controls brightness — 0% is black, 100% is white, 50% is the pure colour.

💡

Why HSL is better for building palettes: To create a lighter tint of a colour, just increase the L value. To desaturate, decrease S. The hue stays the same. In HEX, you would have to do trigonometric colour math. In HSL it's: hsl(220, 80%, 50%) → lighter: hsl(220, 80%, 75%) → darker: hsl(220, 80%, 30%). Same hue, same saturation, just different lightness.

When to Use Which Colour Format

FormatBest Used ForAvoid When
HEX (#FF5733)CSS colour values, brand style guides, Figma/Sketch, email templatesWhen you need to programmatically adjust lightness or saturation
RGB (255,87,51)Android development, Flutter, image processing, when mixing colours programmaticallyBuilding palettes — RGB math is non-intuitive for designers
RGBA (255,87,51,0.8)Transparent overlays in CSS, semi-transparent UI elements, shadowsSolid colours — transparency adds file complexity unnecessarily
HSL (11,100%,60%)Building palettes in CSS, generating tints and shades, Tailwind CSS custom themesSharing with printers — they use CMYK, not HSL
HSLA (11,100%,60%,0.9)Semi-transparent elements where you need colour control + opacityWhen a simple RGBA would suffice
CSS variables (--primary-colour)Component-based design systems, theme switching (light/dark mode)One-off colours that don't repeat

How to Convert Between Colour Formats

The fastest way: use ToolLoom's Color Picker — paste any format and get all three instantly. For manual understanding:

HEX → RGB

Split the HEX into three pairs. Convert each from base-16 to base-10. #4878F0 → 48=72, 78=120, F0=240 → rgb(72, 120, 240).

RGB → HSL

Normalise each channel to 0–1 (divide by 255). Find max and min. Lightness = (max+min)/2. Saturation depends on whether you are at max or min. Hue is calculated from which channel is max. This is complex to do manually — use ToolLoom's converter.

HSL → HEX

Convert HSL to RGB using the standard formula (involves converting hue to one of 6 sectors of the colour wheel), then convert each RGB channel to a 2-digit hex. Again — the Color Picker handles this instantly.

💡

In VS Code: Hover over any colour value in a CSS file — VS Code shows a colour preview and lets you click to open a colour picker inline. Click the top of the picker to cycle between HEX, RGB, and HSL formats. This is the fastest workflow for developers already in their editor.

Colour Accessibility — Contrast Ratios & WCAG

Colour contrast is not just a nice-to-have — it is a legal requirement for government websites in India and a best practice for any product with Indian users, where a significant portion browse on mid-range Android devices with uncalibrated screens.

WCAG LevelNormal TextLarge Text (18pt+)Requirement
Level A (minimum)No requirementNo requirementBasic accessibility
Level AA (standard)4.5:1 minimum3:1 minimumRequired for Indian govt sites (GIGW)
Level AAA (enhanced)7:1 minimum4.5:1 minimumRecommended for highest accessibility
Good contrast
Black text (#000000) on white (#FFFFFF) = 21:1 ratio — maximum contrast. Dark navy on white = ~15:1. All pass AA easily.
⚠️
Common failures
Light grey text on white background often fails AA. Yellow text on white = ~1.07:1 — almost invisible. Always check before shipping.
🔍
How to check
Use ToolLoom's Color Picker contrast checker, or WebAIM Contrast Checker (webaim.org/resources/contrastchecker). Enter foreground and background HEX codes.
🇮🇳
India-specific
GIGW (Guidelines for Indian Government Websites) mandates WCAG 2.1 AA for all central government websites. This applies to NIC-hosted sites, ministry portals, and state government websites.
⚠️

Don't rely on colour alone: About 8% of men and 0.5% of women globally have some form of colour vision deficiency (colour blindness). The most common type — red-green colour blindness — makes red and green indistinguishable. Always pair colour with a secondary indicator (icon, text label, pattern) for critical UI states like errors, success, and warnings.

Building Colour Palettes — Harmony Rules

Harmony TypeDescriptionHSL RelationshipBest For
MonochromaticSame hue, different lightness/saturationSame H, vary L and SClean, minimal UI; single-brand products
ComplementaryOpposite colours on the wheelH + 180°High contrast, energetic; buttons on hero sections
AnalogousAdjacent colours (within 30–60°)H ± 30° to 60°Calm, natural palettes; health, wellness apps
TriadicThree equally spaced huesH, H+120°, H+240°Vibrant, balanced; playful or creative products
Split-complementaryBase + two colours adjacent to its complementH, H+150°, H+210°High contrast with more variety than complementary
💡

The 60-30-10 rule: Effective colour palettes use a dominant colour (60% of the design), a secondary colour (30%), and an accent (10%). Example: white/light grey dominant, dark navy secondary, orange accent. This is the structure behind most successful fintech and SaaS products in India.

Colour in Indian UI/UX Design

Indian digital products have distinct colour preferences rooted in cultural associations, device display characteristics, and audience demographics. Understanding these helps designers make choices that resonate with Indian users.

Using Colour Codes in CSS & Tailwind

Once you have your colour code from the picker, here is how to use it effectively in web development:

ContextCSS CodeNotes
Solid colour (HEX)color: #4878F0;Most common; all browsers support HEX
With opacity (RGBA)color: rgba(72,120,240,0.8);4th value = opacity (0–1)
HSL in CSScolor: hsl(220, 80%, 61%);Best for building scales with CSS variables
CSS custom property--primary: #4878F0;Define in :root{} — reuse everywhere
Tailwind arbitrary valuebg-[#4878F0]Use bracket notation for custom colours
Tailwind configcolors: { brand: '#4878F0' }Add to tailwind.config.js extend.colors

Best practice for design systems: Define all brand colours as CSS custom properties in :root{}. Use semantic names like --colour-primary, --colour-success, --colour-text-muted rather than --blue-500. This makes light/dark mode theming trivial — just redefine the variables in a [data-theme="dark"] selector.

🎨 Pick Any Colour Instantly — Free

ToolLoom's Color Picker gives you HEX, RGB, and HSL codes instantly. Pick from the colour wheel, enter any code to convert, check contrast ratios, and copy values with one click.

Open Color Picker →

5 Common Colour Mistakes Designers Make

MistakeWhy It's a ProblemFix
Not checking colour contrastText that looks fine on your calibrated monitor may fail WCAG AA on budget Android displays — alienating a huge portion of Indian usersAlways run foreground/background pairs through a contrast checker before finalising
Using colour alone to convey meaningRed = error, green = success fails for red-green colour blind users (8% of men)Pair colour with an icon (✗ ✓) or text label ("Error", "Success")
Too many accent coloursMore than 2–3 accent colours creates visual noise and weakens brand recognitionPick one primary, one secondary, one accent — use tints and shades for variety
Choosing colours in isolationA colour may look beautiful alone but fail against your actual background or alongside brand coloursAlways test colours in context — on your actual page layout, not a blank white canvas
Ignoring dark mode implicationsA dark navy colour that works on light mode may become near-invisible on dark mode backgroundsDesign and test both modes from the start — use HSL variables to invert lightness systematically

Frequently Asked Questions

HEX is a 6-digit hexadecimal code (#FF5733) — the most common format for web and graphic design. RGB specifies Red, Green, Blue values each from 0–255 — intuitive for colour mixing. HSL specifies Hue (0–360°), Saturation (0–100%), and Lightness (0–100%) — the most intuitive for designers adjusting colour relationships. All three represent the same colour in different notations.
Use ToolLoom's Color Picker. For picking colours from existing websites: use browser DevTools (F12 → Elements → click any colour swatch). On Windows: PowerToys Color Picker (Win+Shift+C). On Mac: Digital Color Meter (built-in). On mobile: Color Grab (Android) or Pastel (iOS).
WCAG defines minimum contrast ratios to ensure readability for visually impaired users. Level AA (required for Indian government websites): normal text needs 4.5:1 ratio; large text 3:1. Level AAA: 7:1 for normal text. India's GIGW mandates WCAG 2.1 AA for all central government portals.
Indian digital audiences prefer vibrant, saturated colours. High-performing combinations: saffron/orange with white (Swiggy, Zomato style — trust + energy); deep blue with gold (HDFC, Bajaj — premium); green with white (PhonePe, Groww — growth). Avoid very low-contrast pastels — they perform poorly on budget Android screens which dominate India's device market.
A colour picker lets you select any specific colour and retrieve its code. A palette generator takes one colour and produces a harmonious set — complementary, triadic, analogous. ToolLoom's Color Picker handles both: pick a colour, get all codes, and see related colour suggestions.
Split the 6-digit HEX into three pairs and convert each from hex to decimal. Example: #4878F0 → 48=72, 78=120, F0=240 → RGB(72, 120, 240). ToolLoom's Color Picker converts between all formats instantly — paste any HEX and get RGB and HSL immediately.

More from ToolLoom

About ToolLoom

ToolLoom builds free design and developer tools for Indian students, professionals, and creators. Found a bug or want a feature in the Color Picker? Email us at contact@toolloom.in