complete.tools

Color Picker & Converter

Pick colors visually and convert between HEX, RGB, HSL, and CMYK formats with palette generation.

What this tool does

The Color Picker & Converter is a comprehensive tool for selecting, converting, and analyzing colors across multiple color formats. It provides a visual color picker using a saturation-brightness canvas and hue slider, allowing you to intuitively select any color and immediately see its representation in HEX, RGB, HSL, and CMYK formats. All format inputs are bidirectionally synced, so changing any value updates all others in real time. The tool also generates color palettes including complementary, analogous, triadic, and split-complementary schemes, and includes a WCAG contrast ratio checker to verify text readability against background colors. Every calculation runs entirely in your browser with no data sent to any server.

How it calculates

**HSL to RGB Conversion:** The tool stores color state internally as HSL (Hue, Saturation, Lightness). To convert to RGB, it calculates chroma C = (1 - |2L - 1|) * S, an intermediate value X = C * (1 - |(H/60) mod 2 - 1|), and a lightness offset m = L - C/2. Based on the hue sector (0-60, 60-120, etc.), it assigns R, G, B from combinations of C, X, and 0, then adds m and scales to 0-255.

**RGB to HSL Conversion:** Given R, G, B normalized to 0-1, the tool finds the max and min channel values. Lightness L = (max + min) / 2. Saturation S = delta / (1 - |2L - 1|) where delta = max - min. Hue H is computed from the channel differences and scaled to 0-360 degrees.

**RGB to CMYK Conversion:** The Key (black) component K = 1 - max(R, G, B) where channels are normalized to 0-1. Then C = (1 - R - K) / (1 - K), M = (1 - G - K) / (1 - K), Y = (1 - B - K) / (1 - K). All values are expressed as percentages.

**WCAG Contrast Ratio:** Relative luminance is calculated as L = 0.2126 * R' + 0.7152 * G' + 0.0722 * B', where each channel undergoes gamma correction. The contrast ratio = (L1 + 0.05) / (L2 + 0.05) where L1 is the lighter luminance.

Color formats explained

**HEX** is the most common format for web development, representing colors as a six-digit hexadecimal string prefixed with #. Each pair of digits encodes one of the three RGB channels (00-FF). For example, #FF5733 means R=255, G=87, B=51. Use HEX when writing CSS or HTML.

**RGB (Red, Green, Blue)** defines colors by mixing three light channels from 0 to 255. It is the native format for computer screens and is used in CSS as rgb(255, 87, 51). RGB is intuitive for understanding how displays produce colors.

**HSL (Hue, Saturation, Lightness)** describes colors in terms humans understand more naturally. Hue is the color wheel angle (0-360), saturation is the intensity (0-100%), and lightness is how light or dark the color is (0-100%). HSL is preferred when you need to generate variations of a color, such as lighter or darker shades.

**CMYK (Cyan, Magenta, Yellow, Key/Black)** is the subtractive color model used in printing. Unlike RGB which adds light, CMYK subtracts light from white paper. Values are expressed as percentages. Note that screen CMYK is an approximation; actual print output depends on the printer, paper, and ICC profiles.

Worked examples

**Example 1: Converting HEX to RGB** Input: #3498DB. Split into pairs: 34, 98, DB. Convert from hexadecimal: R = 52, G = 152, B = 219. The RGB representation is rgb(52, 152, 219).

**Example 2: Finding a complementary color** Start with a blue at HSL(210, 80%, 55%). The complementary color is 180 degrees away on the hue wheel: HSL(30, 80%, 55%), which produces a warm orange. This pairing creates maximum visual contrast.

**Example 3: Checking contrast for accessibility** Foreground: white (#FFFFFF), Background: medium blue (#3498DB). White has relative luminance 1.0 and the blue has approximately 0.29. Contrast ratio = (1.0 + 0.05) / (0.29 + 0.05) = 3.09:1. This fails WCAG AA for normal text (requires 4.5:1) but passes for large text (requires 3:1).

**Example 4: RGB to CMYK for print** RGB(52, 152, 219). Normalize: R'=0.204, G'=0.596, B'=0.859. K = 1 - 0.859 = 0.141. C = (1 - 0.204 - 0.141) / 0.859 = 76%. M = (1 - 0.596 - 0.141) / 0.859 = 31%. Y = (1 - 0.859 - 0.141) / 0.859 = 0%. Result: cmyk(76%, 31%, 0%, 14%).

Limitations

**CMYK accuracy:** The CMYK values shown are mathematical approximations. Real-world print colors depend on ink characteristics, paper type, and ICC color profiles. For production printing, always use calibrated color management software rather than simple RGB-to-CMYK conversion formulas.

**Color gamut differences:** sRGB (the standard screen color space) and CMYK have different gamuts. Some vibrant screen colors cannot be reproduced in print, and some print colors fall outside sRGB. This tool does not perform gamut mapping or warn about out-of-gamut colors.

**Monitor calibration:** The colors displayed on your screen depend on your monitor's calibration and color profile. Two monitors showing the same HEX value may appear visually different. For color-critical work, use a hardware calibration device.

**Accessibility approximation:** The WCAG contrast ratio calculation assumes sRGB and standard viewing conditions. It does not account for visual impairments beyond low vision, such as specific types of color blindness.

FAQs

**Q: What is the best color format for web development?** A: HEX is the most widely used and compact format for CSS. HSL is better when you need to create color variations programmatically, such as generating lighter shades by increasing lightness. Modern CSS supports all three formats natively.

**Q: What contrast ratio do I need for WCAG compliance?** A: WCAG AA requires a minimum contrast ratio of 4.5:1 for normal text and 3:1 for large text (18px bold or 24px regular). WCAG AAA requires 7:1 for normal text and 4.5:1 for large text. The tool shows pass/fail status for both levels.

**Q: Why does my printed color look different from the screen?** A: Screens use additive RGB color mixing (adding light), while printers use subtractive CMYK mixing (absorbing light from paper). The two systems have different color gamuts, and many bright screen colors simply cannot be reproduced with ink. Always request a press proof for color-critical print work.

**Q: How are palette colors calculated?** A: Palette colors are generated by rotating the hue angle on the HSL color wheel while keeping saturation and lightness constant. Complementary adds 180 degrees, analogous adds plus/minus 30 degrees, triadic adds 120 and 240 degrees, and split-complementary adds 150 and 210 degrees.

Explore Similar Tools

Explore more tools like this one:

- Color Picker & Eyedropper — Pick any color from your screen using the browser's... - Color Hex to RGB Converter — Convert hex color codes to RGB, RGBA, and HSL formats... - Color Palette Extractor from Image — Extract dominant colors and hex codes from any image... - Image Color Picker — Upload an image and pick specific pixel colors. Get Hex,... - Base Converter (Radix) — Convert numbers between Binary, Octal, Decimal,...