Web Dev

How to Use a Color Picker — Hex, RGB, HSL Codes Explained

February 17, 2026 5 min read 7,800 views
IA
Imran Ashraf
Founder, ToolMatrix

Color Formats in Web Design — Overview

CSS supports multiple ways to define colors, each with its own strengths. As a designer or developer, understanding when to use Hex, RGB, or HSL will make your workflow significantly faster and your code more maintainable.

All formats represent the same underlying color — they're just different ways to express it. Most color pickers (including ours) let you convert between all formats instantly.

Hex Color Codes — The Most Common Format

Hex (hexadecimal) codes are the most widely used color format in web design. They look like #10b981 — a hash symbol followed by 6 characters representing Red, Green, and Blue values in base-16.

  • Format: #RRGGBB (each pair 00–FF)
  • Example: #10b981 = Red:16, Green:185, Blue:129
  • Short form: #fff = #ffffff (when both digits are equal)
  • With opacity: #10b981CC (last 2 digits = alpha, CC = 80% opacity)

Best for: Design tokens, CSS variables, Tailwind config, and any time you need a compact, easy-to-copy color reference. Most design tools (Figma, Adobe XD) output Hex by default.

RGB and RGBA — Precise Color Control

RGB defines colors using decimal values for Red, Green, and Blue, each from 0–255. RGBA adds an Alpha (opacity) channel from 0 (fully transparent) to 1 (fully opaque).

rgb(16, 185, 129)        /* ToolMatrix green */
rgba(16, 185, 129, 0.15) /* 15% opacity — useful for backgrounds */

Best for: Dynamic color manipulation in JavaScript, transparency effects, and when you need to programmatically adjust individual color channels.

HSL and HSLA — Designer-Friendly Format

HSL stands for Hue, Saturation, Lightness — and it's the most intuitive format for creating color variations. Instead of thinking in RGB channels, you think in terms of "what color" (hue), "how vivid" (saturation), and "how light or dark" (lightness).

hsl(160, 84%, 39%)         /* ToolMatrix green */
hsl(160, 84%, 60%)         /* Lighter version — just change the L value */
hsl(160, 84%, 25%)         /* Darker version — same hue, lower lightness */

Best for: Creating color scales and variations. To create a hover state, just decrease lightness by 10%. To create a disabled state, reduce saturation. This is much more intuitive than guessing Hex values.

How to Pick a Color from an Image (Eyedropper)

1

Upload Image to Color Picker

Drag any image onto our Color Picker tool. Brand screenshots, design mockups, photos — anything works.

2

Click Any Pixel

Click anywhere on the image to sample that exact color. The tool instantly shows Hex, RGB, and HSL values for that pixel.

3

Copy Your Color Code

Click any format to copy to clipboard. Use it directly in your CSS, design tool, or code.

Building a Consistent Color Palette

Professional UI design uses a systematic color palette rather than random individual colors. A typical palette structure:

RoleDescriptionExample
PrimaryMain brand color, buttons, links#10b981
SecondaryAccent, highlights#0ea5e9
NeutralText, borders, backgrounds#64748b
SuccessPositive states, confirmations#22c55e
WarningCaution states#f59e0b
ErrorError states, destructive actions#ef4444
🎨

Open Color Picker — Free

Pick from canvas, sample from image, convert between Hex/RGB/HSL instantly.

Open Color Picker

Use ToolMatrix Color Picker

Our Color Picker includes a full canvas picker, eyedropper for sampling colors from uploaded images, instant conversion between all formats, and a saved colors palette. No signup, completely free, works on mobile and desktop.

IA
Imran Ashraf
Founder & Editor, ToolMatrix
Imran is the founder of ToolMatrix with 10+ years in web development and digital productivity. He writes practical guides to help users work smarter with free online tools.