Tag: Color Tools

  • Extract Colors from Image: Auto Palette Tool [2026]

    Extract Colors from Image: Auto Palette Tool [2026]

    TL;DR: An image color extractor analyses a photo or graphic and returns the 2–12 most representative colours as a palette. Behind the scenes most extractors run K-means clustering on the pixel data, sort the resulting clusters by population, and output each centroid as HEX/RGB/HSL. Use it for moodboards, brand palettes from a photo, theme generation, or matching ad creative to a hero image. Our free image color extractor runs entirely in your browser, supports up to 12 colours, and exports CSS variables ready to drop into your stylesheet.

    Designers extract colour palettes from images constantly. A photographer wants the dominant tones of a portrait for the gradient behind a website hero. A brand strategist needs the four real colours from a screenshot of a competitor’s ad. A film designer wants the palette of a single frame to match the rest of the spread. Doing this by eye works for two or three colours; doing it accurately for ten requires an algorithm that looks at every pixel.

    Our image color extractor runs K-means clustering directly in your browser via WebAssembly. Drop an image, pick how many colours (2 to 12), and the tool returns the centroids ranked by how much of the image each colour represents. Each swatch shows HEX, RGB, HSL, OKLCH, and the WCAG contrast ratio against black and white — useful for picking accessible text colours from a brand photo. This guide covers how K-means works in colour space, why it sometimes returns near-duplicate colours, and the gotchas with transparent backgrounds and EXIF rotation.

    When to use a palette extractor

    Use case Recommended count What you do with it
    Hero gradient from a photo 2–3 colours Use top 2 as gradient stops
    Brand palette from a logo 3–5 Verify exact brand HEX values
    Moodboard / inspiration 5–8 Save the swatches as a Figma library
    Album cover analysis 5–6 Generate a matching theme
    Ad creative colour match 3–4 Paint background to harmonise with image
    Competitor screenshot study 8–10 Audit their full palette

    How K-means clustering works (in colour terms)

    Plot every pixel as a point in a 3D colour space (RGB, or better still OKLab for perceptual uniformity). K-means then partitions those points into k clusters by:

    1. Pick k initial cluster centres at random (or via k-means++ for better starting points)
    2. Assign every pixel to the nearest centre
    3. Recompute each centre as the average of the pixels assigned to it
    4. Repeat steps 2–3 until centres stop moving (convergence)

    The output is k colours that minimise the total distance between every pixel and its assigned centre. Cluster size (number of pixels assigned) tells you how dominant each colour is in the original image.

    We use OKLab as the clustering space — distances in OKLab roughly match human perception, so two colours that look similar are also close in OKLab. Older extractors run K-means in raw RGB and produce odd results when an image has a wide hue range (RGB distance treats yellow and blue as much closer than the eye does).

    How to extract a palette in your browser

    1. Open the image color extractor
    2. Drop an image (JPG, PNG, WebP, HEIC supported)
    3. Pick the colour count (2–12)
    4. The palette appears in 1–3 seconds with each swatch labelled by HEX and percentage of the image
    5. Toggle Sort by percentage or Sort by hue
    6. Click any swatch to copy its HEX, RGB, HSL, or OKLCH
    7. Click Export CSS variables to download a --brand-N variable block ready to paste into :root

    Common gotchas

    • Near-duplicate colours. If your image is mostly skin tones, K-means with k=10 returns ten variations of the same beige. Drop k to 4–5, or use the “merge similar” option which post-processes the output to deduplicate within a perceptual distance threshold.
    • Transparent backgrounds skew the result. A logo on transparent background still has many fully-transparent pixels — by default we skip those. If your output looks wrong, check that the “ignore transparent” toggle is on.
    • EXIF rotation isn’t honoured by all extractors. A portrait photo from a phone is often stored as a landscape file with EXIF rotation metadata. Our tool reads the EXIF rotation and re-orients before extraction. Some tools don’t, and produce confusing palettes from the wrong “side” of the image.
    • JPEG compression artefacts inflate the palette. Compressed JPGs introduce subtle colour fringes near edges. K-means treats these as legitimate colours and may include them. Using a slightly higher k and merging similar colours afterward gives cleaner output.
    • Resolution matters less than you think. The tool downsamples to ~512×512 internally before clustering. A 4000×3000 photo and an 800×600 version of the same image produce nearly identical palettes — clustering is statistical, not pixel-perfect.
    • Random initialisation = slightly different output each run. K-means uses random starting points, so two runs on the same image can return slightly different palettes (within ~5% colour distance). For reproducibility, use the seeded mode with a fixed seed.

    Accessibility — pick text colours from the palette

    A common workflow: extract a palette from a hero photo, then use one of the extracted colours as the background and need a text colour that meets WCAG contrast on it. Each swatch in our output shows the contrast ratio against black and white — pick the colour combination with a ratio above 4.5:1 (AA standard for body text) or 7:1 (AAA). For coloured-text-on-coloured-background combinations, our “Pair check” overlay shows the contrast between any two extracted colours.

    When NOT to use this tool

    For brand-exact colours from a logo SVG, open the SVG and read the fill values directly — extraction approximates and can introduce small errors. For animated GIFs, the extractor uses only the first frame; for the full palette across all frames you’ll need a video-aware tool. For very small icons (under 64×64), there often aren’t enough pixels for K-means to produce a meaningful palette — pick the colours by eye instead. For batch processing many images in a CI pipeline, install node-vibrant or color-thief locally and write a script — much faster than running this tool by hand on each file.

    Frequently asked questions

    How accurate is the extracted palette?

    K-means in OKLab space gives results that closely match what a designer would pick by eye. The dominant 1–2 colours are virtually exact; minor colours can vary by a few HSL points between runs because of random initialisation. For pixel-perfect brand colours, sample directly from the source file with an image color picker instead.

    How many colours should I extract?

    3–5 for design palettes, 2 for hero gradients, 8+ for moodboards and competitive analysis. More than 8 colours often produces near-duplicates; fewer than 3 misses meaningful tones. Start with 5 and adjust.

    Why does the same image return different palettes?

    K-means uses random initialisation, so two runs can produce slightly different centroids. Differences are usually under 5% perceptual distance. Use the seeded mode (with a fixed seed string) for reproducible output across runs.

    Does it support transparent backgrounds?

    Yes — fully-transparent pixels are skipped by default. Semi-transparent pixels are blended against your chosen “background colour” (white by default). Toggle the background to dark or your brand colour for accurate extraction from logos with see-through regions.

    Is my image uploaded?

    No. The extractor runs K-means in your browser via WebAssembly. The image is loaded into a blob URL and the pixel data is processed locally — never uploaded.

    Can I export the palette in a specific format?

    Yes — the export menu offers JSON (programmatic), CSS variables (--brand-1: #... ready for :root), Tailwind config (drop into theme.extend.colors), Adobe ASE swatch file, and a PNG of the palette swatches.

    Related tools and guides

     

  • Average Color of an Image: Finder Tool [2026]

    Average Color of an Image: Finder Tool [2026]

    TL;DR: An image average color finder computes the single colour that best represents an image — usually the arithmetic mean of every pixel’s RGB values. The mean often produces a muddy gray for colourful images; the dominant colour (most-frequent cluster) is usually more useful. Used for hero gradients that match a photo, fallback colours while a lazy-loaded image loads, theme-detection from album art, and accessibility checks. Our free image average color finder reports mean, median, and dominant in one go.

    “What’s the average colour of this image?” is a deceptively simple question. The naive answer — sum every pixel’s red, green, and blue values, divide by total pixels — produces the mean colour, but that’s often a muddy brown that doesn’t match anyone’s intuition of what the image “looks like”. A bright photo of a sunset (oranges, reds, dark blues) averages to a dull purple-grey. The dominant colour — the colour that appears most frequently after clustering — is usually a more useful answer.

    Our image average color finder reports four different metrics at once: mean (arithmetic average), median (the colour at the centre of the distribution), dominant (most common after clustering), and weighted average (excluding background pixels). Pick the one that matches your need. Drop in any image, get all four values as HEX/RGB/HSL/OKLCH, plus a CSS-variable export. Browser-only.

    Mean vs median vs dominant — pick the right metric

    Metric How it’s computed Best for
    Mean Sum each channel, divide by pixel count Lazy-load placeholders (BlurHash equivalent)
    Median Value at the 50th percentile per channel Robust against outlier pixels
    Dominant Most common cluster after K-means k=1 Theme detection, brand-color extraction
    Weighted Mean excluding near-white / near-black Photos with white background; ignores chrome
    Center-weighted Mean with central pixels weighted higher Subject-focused content (portraits, product shots)

    Why mean often disappoints

    Imagine an image of a sunset: red sun, orange sky, blue water. The mean of red + orange + blue is a desaturated brown-grey — a colour that nothing in the image actually is. Mean is a statistical average, not a perceptual representative. For lazy-load placeholders this is fine (you want a single colour that’s unobtrusive), but for “what colour is this image?” answers, dominant is usually closer to intuition.

    Mean works well for:

    • Image-loading placeholders (Material Design’s blur-up technique)
    • Fallback background colour while lazy-loading
    • Generating a complementary text-overlay colour

    Dominant works better for:

    • Theme detection — pick a UI accent colour matching a hero photo
    • Brand-colour extraction from a logo
    • Generating gradient backgrounds that “match” the image

    How to find the average color

    1. Open the average color finder
    2. Drop your image (JPG, PNG, WebP, HEIC supported)
    3. The tool computes mean, median, dominant, weighted average — all four — in 1–2 seconds
    4. Pick the metric that fits your use case; copy HEX, RGB, HSL, or OKLCH
    5. Export as CSS variable (--image-color: #94896D) for direct use in stylesheets

    Common gotchas

    • Transparent pixels affect mean. By default we count fully-transparent pixels as the chosen “background” colour (white by default). Toggle “ignore alpha” to skip them entirely — better for logos on transparent backgrounds.
    • Resolution affects performance. Computing mean is O(n) over pixel count. A 4000×3000 image (12M pixels) processes in ~200ms; a 12000×9000 image (108M pixels) takes ~2 seconds. The tool downsamples to 1024×1024 internally for speed — visually identical result for any image larger than that.
    • JPEG compression artefacts shift the mean. Heavily compressed JPGs introduce per-block colour shifts that pull the mean toward greys. For brand-color work, use original PNG / TIFF / WebP if available.
    • EXIF rotation matters. A photo from a phone may be stored sideways with EXIF rotation metadata. Our tool reads the EXIF orientation and applies it before computing — ensures the “mean” is over the visible image, not a sideways version.
    • Per-region sampling for hero images. A hero image often has chrome at the top (logo, navigation) that you don’t want included in the average. Use the “region” tool to draw a rectangle covering only the photographic content, then compute over that.
    • Color space matters. Mean in RGB space biases toward greys (perceptually inaccurate). Mean in OKLab space produces a more perceptually-uniform answer. Our tool reports both — pick OKLab for design work, RGB for compatibility.

    When NOT to use this tool

    For a multi-colour palette extracted from an image, use the Image Color Extractor — it returns 2–12 colours via K-means clustering. For pixel-perfect colour sampling at a single point, use the Image Color Picker — it shows the exact colour under your cursor. For lazy-load placeholders in production, libraries like plaiceholder or blurhash are more efficient than recomputing on every page load. For colour-detection in real-time video, use OpenCV.js or a WebGPU shader — much faster than per-frame canvas sampling.

    Frequently asked questions

    Why does the mean colour look different from the image?

    Mean is a statistical average across all pixels. For images with high colour variation (sunsets, landscapes), the mean often lands in muddy territory — desaturated brown or grey — because opposing colours cancel out. The dominant colour is usually closer to what you’d intuitively call “the image’s colour”.

    Mean, median, or dominant — which should I use?

    For lazy-load placeholders: mean (unobtrusive). For theme detection or brand-colour extraction: dominant. For photos with extreme outliers (one bright spot in a dark image): median. Try all four — our tool computes them simultaneously and shows all swatches.

    Does it support transparent backgrounds?

    Yes — toggle “ignore alpha” to skip transparent pixels entirely. Otherwise transparent pixels are blended against your chosen background colour (white by default). Critical for logos on transparent backgrounds.

    Can I sample a specific region?

    Yes — draw a rectangle on the image to limit the sample area. Useful for hero images where you want to skip the navigation chrome, or product photos where you want to skip the white background.

    Is my image uploaded?

    No. The finder runs in your browser via the canvas API. Image data is processed locally — never sent to our servers.

    What’s the difference between OKLab and RGB averaging?

    Averaging in RGB biases toward greys because R+G+B sums tend to centre around perceptual middle. Averaging in OKLab (a perceptually-uniform colour space) produces a result closer to what the eye perceives as the “centre” of the image’s colour distribution. Our tool reports both for comparison.

    Related tools and guides

     

  • RGB to HEX Converter: Convert Any Color [2026]

    RGB to HEX Converter: Convert Any Color [2026]

    TL;DR: RGB to HEX conversion takes a color expressed as three 0–255 channels (red, green, blue) and outputs a 6-digit hexadecimal code prefixed with #. rgb(99, 91, 255) becomes #635BFF. With an alpha channel, you get an 8-digit HEX: rgba(99, 91, 255, 0.5)#635BFF80. Our free RGB to HEX converter handles all common formats — RGB, RGBA, HSL, HSV, CMYK, OKLCH — with a live colour swatch, WCAG contrast scores, and named-colour matching.

    Web designers convert colours between RGB and HEX dozens of times a week. A designer hands you an RGB triplet from Figma; a stylesheet uses HEX; a UI library expects HSL; a print spec demands CMYK. Every framework picks its favourite and assumes you’ll convert the rest. Mental math works for greyscale (rgb(255,255,255) = #FFFFFF) but fails for anything in between — converting 91 to 5B in your head is a recipe for typos.

    Our RGB to HEX converter handles every direction (RGB ↔ HEX ↔ HSL ↔ HSV ↔ CMYK ↔ OKLCH), preserves alpha channels correctly, and shows a large colour preview alongside every value. Each output also includes the WCAG contrast ratio against pure black and pure white, so you can rule out colours that fail accessibility audits in one glance. This guide covers exactly how the conversion works, why 8-digit HEX matters in modern CSS, and the gotchas that turn a perfect conversion into a wrong one.

    Format reference: RGB, HEX, HSL, OKLCH

    Format Example Best for
    HEX (6-digit) #635BFF Brand colours, opaque CSS, copy-paste from Figma
    HEX (8-digit, with alpha) #635BFF80 Translucent overlays — same brevity as HEX
    RGB rgb(99, 91, 255) Programmatic generation, design tools
    RGBA rgba(99, 91, 255, 0.5) Translucent fills with explicit alpha
    HSL hsl(243, 100%, 68%) Dynamic shade adjustments (modify L only)
    HSV / HSB hsv(243, 64%, 100%) Photoshop / Sketch picker workflow
    CMYK cmyk(61%, 64%, 0%, 0%) Print specs only — never web
    OKLCH oklch(56% 0.27 270) Modern CSS, perceptually-uniform palettes

    How the math works

    RGB to HEX is a straight base-10 to base-16 conversion of three numbers, padded to 2 digits each:

    // rgb(99, 91, 255) → #635BFF
    const toHex = (n) => n.toString(16).padStart(2, "0").toUpperCase();
    const hex = `#${toHex(99)}${toHex(91)}${toHex(255)}`;
    // → "#635BFF"

    For 8-digit HEX with alpha, append a fourth pair scaled from 0–1 to 0–255: 0.5 × 255 = 127.5 → rounds to 128 → 0x80. Result: #635BFF80. Note that 8-digit HEX with alpha is widely supported (Chrome 62+, Firefox 49+, Safari 9.1+) — well over 95% of users in 2026 — so you can safely replace rgba(...) with 8-digit HEX in modern stylesheets.

    How to convert RGB to HEX in your browser

    1. Open the RGB to HEX converter
    2. Pick the colour with the visual picker, OR type a value in any format
    3. All other formats update in real time below the input
    4. Copy any result with one click; the colour preview matches what you’ll get on screen
    5. WCAG contrast scores against black and white show inline — useful for accessibility checks

    3-digit HEX shorthand and when it works

    CSS allows #FFF as shorthand for #FFFFFF, and #F0A for #FF00AA. Each digit duplicates: #ABC means #AABBCC. This works only when each channel pair has identical digits — #635BFF (no duplicate pairs) cannot be expressed in 3-digit form. The shorthand also has a 4-digit alpha variant: #FFF8 means #FFFFFF88 — an alpha of 0x88 (about 53%).

    Most minifiers expand 3-digit HEX to 6-digit during build, then the gzipped output ends up similar size. Don’t write code that depends on the format — semantically #FFF and #FFFFFF are identical.

    Common gotchas

    • HEX is case-insensitive but lowercase is conventional in CSS. #635BFF and #635bff render identically. Modern style guides (Airbnb, Google) lowercase by default; some teams uppercase for visual contrast against text.
    • Browser colors object accepts named colours. red#FF0000, cornflowerblue#6495ED. Our converter recognises all 147 CSS named colours and shows the matching name where one exists.
    • HSL is not perceptually uniform. Two HSL colours with identical L (lightness) can look very different in brightness — yellow at L=50% looks much brighter than blue at L=50%. Use OKLCH if you want perceptually-uniform palettes.
    • CMYK conversion is approximate. RGB and CMYK have different gamuts (printers can’t reproduce all RGB colours, and vice versa). Our CMYK output is a naive conversion, not an ICC-profile-based one. For print specs, pick CMYK in Adobe Illustrator with the right profile loaded.
    • Alpha precision differs. rgba(255,0,0,0.5) rounds to #FF000080, but 0.5 × 255 = 127.5 rounds up. Round-tripping #FF000080 back gives 0.502. The 1-in-256 quantisation is invisible to the eye.
    • OKLCH chroma maxes out around 0.4. Higher values either clamp to the gamut or produce out-of-gamut colours (which browsers display as the closest in-gamut equivalent). Our converter shows when an OKLCH value exceeds the sRGB gamut.

    When NOT to use a converter

    For programmatic conversion in code, use the language-native API: CSS Color Module 4 in modern browsers (CSS.color()), Color.js or chroma.js for batch conversion, or color npm for Node.js. For design tools (Figma, Sketch, Adobe XD), the built-in colour picker handles every conversion natively. Use this browser tool for one-off conversions, accessibility audits, brand-spec verifications, and learning the relationship between formats.

    Frequently asked questions

    What’s the difference between RGB and HEX?

    Same colour, different notation. RGB writes the three channels as decimal numbers (0–255 each) separated by commas. HEX concatenates the same three channels as 2-digit hexadecimal numbers prefixed with #. rgb(99, 91, 255) and #635BFF are identical to the browser.

    Can HEX represent transparency?

    Yes — 8-digit HEX includes an alpha channel as the last 2 digits. #635BFF80 is #635BFF at roughly 50% opacity. 8-digit HEX is supported in all modern browsers (Chrome 62+, Firefox 49+, Safari 9.1+) and in CSS Modules 4, so prefer it over rgba() for translucent values.

    Why does my converted HEX look slightly off?

    Probably alpha quantisation — converting rgba(R,G,B,0.5) to HEX rounds 127.5 to 128 (0x80), and back-conversion gives 0.502. The 1-in-256 step is invisible to the eye. If colours look different by more than a single shade, the issue is gamut conversion (RGB to CMYK or OKLCH out-of-gamut), not arithmetic.

    Should I use HEX, RGB, or HSL in my CSS?

    HEX for opaque brand colours (most concise). 8-digit HEX or rgba() for translucency. HSL when you want to dynamically adjust lightness with calc() or CSS variables. OKLCH for new design systems where perceptual uniformity matters. All work everywhere — pick what reads best in your codebase.

    Is my colour data uploaded?

    No. The converter runs in your browser via JavaScript. Colour values you enter never leave your device.

    What’s OKLCH and why do designers use it?

    OKLCH is a perceptually-uniform colour space (defined in CSS Color Module 4). Lightness, chroma, and hue map to how the eye perceives them — adjust L by 10% and the colour looks 10% lighter regardless of hue. HSL doesn’t have this property: yellow at L=50% looks much brighter than blue at L=50%. OKLCH is supported natively in Chrome 111+, Safari 15.4+, Firefox 113+ — production-safe in 2026.

    Related tools and guides

     

  • HEX to RGBA Converter: All Color Formats at Once [2026]

    HEX to RGBA Converter: All Color Formats at Once [2026]

    TL;DR: A HEX to RGBA converter translates between the hexadecimal colour notation (#635BFF) used by CSS and design tools and the alpha-aware RGBA notation (rgba(99, 91, 255, 0.5)) used for transparent overlays. Our free converter outputs HEX, RGB, RGBA, HSL, HSV, CMYK, and OKLCH all at once, with a live alpha slider and one-click copy on each format.

    Frontend developers translate between colour formats dozens of times a week. The brand book has HEX. The CSS needs RGBA when transparency is involved. The design tool wants HSL or HSV for the colour picker. The print spec needs CMYK. A multi-format colour converter is the kind of utility that sounds trivial until you’ve spent five minutes copy-pasting into a different tool for each format you need.

    Our HEX to RGBA converter takes any HEX value (3-digit shorthand, 6-digit, or 8-digit with alpha) and instantly outputs every common colour format simultaneously. Drag the alpha slider to add transparency without retyping. This guide explains the seven colour formats every web designer encounters, when each is the right choice, and the gotchas that produce subtly-wrong colour conversions.

    The seven colour formats and when each is right

    Format Example Best use
    HEX (6-digit) #635BFF CSS, brand books, design tools — universal web notation
    HEX (8-digit, with alpha) #635BFF80 CSS shorthand for RGBA; 80 = ~50% alpha. Less readable than rgba()
    RGB rgb(99, 91, 255) Programming (every image library uses RGB), some legacy CSS
    RGBA rgba(99, 91, 255, 0.5) CSS with explicit transparency — overlays, glassmorphism, backdrops
    HSL hsl(244, 100%, 68%) Building tints/shades by adjusting one value (lightness)
    HSV / HSB hsv(244, 64%, 100%) Photoshop/Affinity colour picker default — useful for design-tool match
    OKLCH oklch(63% 0.27 286) Modern CSS (Chrome 111+, Safari 15.4+, Firefox 113+); perceptually uniform
    CMYK cmyk(61%, 64%, 0%, 0%) Print only — magazine, brochure, business card

    Why HEX has 6 digits — and the 3-digit shorthand

    A 6-digit HEX encodes red, green, and blue channels at 8-bit precision (0-255 each), written as two hexadecimal digits. #635BFF means red=63 (hex) = 99 (decimal), green=5B = 91, blue=FF = 255.

    The 3-digit shorthand #FFF is equivalent to #FFFFFF — each digit is duplicated. Useful for pure colours but loses precision: only 4096 distinct colours fit in 3-digit shorthand vs 16.7 million in full 6-digit form. CSS accepts both, but designers prefer 6-digit for non-trivial colours.

    The 8-digit form (#635BFF80) adds an alpha channel: the last two hex digits represent transparency from 00 (fully transparent) to FF (fully opaque). 80 in hex is 128 in decimal, or 50% alpha. Most browsers (~98% support since 2018) understand 8-digit HEX, but it’s harder to read than the explicit rgba() form for the same value.

    How to use the browser HEX to RGBA converter

    1. Open the HEX to RGBA converter
    2. Type or paste a HEX value into the input — 3-digit, 6-digit, or 8-digit forms all accepted
    3. Every output format updates instantly: HEX, RGB, RGBA, HSL, HSV, OKLCH, CMYK
    4. Drag the alpha slider (0-100%) to add transparency. The RGBA, 8-digit HEX, HSLA, and HSVA outputs update with the new alpha
    5. Click any format’s copy icon to grab that exact value to your clipboard
    6. Use the inverse (RGBA → HEX) by entering values into the RGB or RGBA fields directly

    Every format also includes a small contrast-ratio readout against pure black and pure white, so you can quickly evaluate whether a colour will pass WCAG AA contrast for body text.

    Converting in code

    Plain JavaScript:

    function hexToRgba(hex, alpha = 1) {
      const m = hex.replace("#", "").match(/^([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i);
      if (!m) return null;
      const [, r, g, b] = m.map((s, i) => i === 0 ? s : parseInt(s, 16));
      return `rgba(${r}, ${g}, ${b}, ${alpha})`;
    }
    
    hexToRgba("#635BFF", 0.5);
    // => "rgba(99, 91, 255, 0.5)"

    Modern CSS (no JavaScript needed):

    /* 8-digit HEX with alpha — supported since 2018 */
    .overlay { background: #635BFF80; }
    
    /* color-mix to add transparency to an existing variable */
    .overlay { background: color-mix(in srgb, var(--brand) 50%, transparent); }
    
    /* RGB notation with optional / alpha — modern CSS Color 4 syntax */
    .overlay { background: rgb(99 91 255 / 0.5); }

    JavaScript with colord:

    import { colord } from "colord";
    
    const c = colord("#635BFF");
    c.toRgb();        // { r: 99, g: 91, b: 255, a: 1 }
    c.toHsl();        // { h: 244, s: 100, l: 68, a: 1 }
    c.alpha(0.5).toRgbString();  // "rgba(99, 91, 255, 0.5)"

    Common gotchas in HEX conversion

    • Mixing up HSL and HSV. HSL’s lightness goes from 0% (black) to 100% (white) with the colour at 50%. HSV’s value goes from 0% (black) to 100% (full colour at maximum). They look similar but produce subtly different results when adjusted. Make sure your design tool uses the same one your CSS does.
    • Trusting CMYK conversion from a screen colour. RGB and CMYK have different gamuts. Vivid screen colours often can’t be reproduced in print. The CMYK output from any web tool is an approximation; use a print-aware tool with ICC profile management for production work.
    • Forgetting alpha in 8-digit HEX. #635BFF and #635BFFFF are identical (FF = 100% alpha). #635BFF80 has 50% alpha. Trim the alpha when you don’t need it for cleaner CSS.
    • Using HSL hue values incorrectly in code. CSS expects hsl(244, 100%, 68%) with hue in degrees. Some libraries store hue normalized to 0-1. Mixing the two produces colours that look right at a glance but are subtly off.

    When to choose RGBA vs 8-digit HEX vs color-mix

    • RGBA for explicit transparency in CSS where the value itself is meaningful (e.g., a 25% black overlay): rgba(0, 0, 0, 0.25) reads more clearly than #00000040.
    • 8-digit HEX for compact CSS when you have a known opaque colour and need a transparent variant: #635BFF80 is shorter than rgba(99, 91, 255, 0.5).
    • color-mix(in srgb, var(–brand) 50%, transparent) for derived transparency from a CSS variable. Lets your brand colour change once and all transparent variants update.
    • RGB with slash notation (CSS Color 4): rgb(99 91 255 / 0.5) — the modern standard, supported in 95%+ of browsers as of 2026.

    Frequently asked questions

    Why does my HEX colour look different in different applications?

    Three common causes: (1) your monitor’s colour profile differs from the source — calibrate displays for consistent results across devices; (2) the source uses Display P3 colour space (modern Macs, iPhones) and the target only renders sRGB; (3) image gamma or colour management differences between Photoshop, browsers, and print drivers. The HEX value is the same; the rendering varies.

    Should I use 6-digit or 8-digit HEX?

    6-digit for opaque colours — universal, readable, supported everywhere. 8-digit when transparency is essential — cleaner than rgba() in some cases. Avoid 8-digit if you’ll still need to support browsers older than 2018 (effectively zero modern audience, but rare legacy contexts exist).

    Does the converter handle CSS variables?

    The tool converts the resolved colour value, not CSS variable references themselves. To convert var(--brand) via the tool, look up the actual HEX value in your stylesheet first. For runtime variable conversion in JavaScript, use getComputedStyle(element).getPropertyValue('--brand') to read the resolved value.

    What’s the difference between HSL and OKLCH?

    HSL uses a cylindrical model with hue rotation, but its lightness isn’t perceptually uniform — equal numerical changes produce visually unequal changes (especially around yellow and cyan). OKLCH uses a perceptually uniform colour space, so equal lightness changes look equal regardless of hue. OKLCH is the modern best practice for design systems; HSL is fine for simple tints and shades within a single hue.

    Can the tool convert HEX to print-ready CMYK?

    The CMYK output is an approximation derived from sRGB → CMYK conversion. For production print, ask your printer for their colour-managed conversion using your specific ICC profile. The tool gets you within ~10% of the printer’s value, which is fine for proofs and mockups but not for final print specs.

    Is my colour data sent anywhere?

    No. The converter runs entirely in your browser using JavaScript. The HEX you type, the alpha you adjust, and the converted outputs all stay on your device. Verify in DevTools’ Network tab — there are no requests when you type or convert.

    Related tools and guides

     

  • Color Mixer Tool: Blend Two Colours in OKLCH [2026]

    Color Mixer Tool: Blend Two Colours in OKLCH [2026]

    TL;DR: A color mixer tool blends two colours by interpolating between them in RGB, HSL, or OKLCH colour space. Use it to find the perfect mid-point for gradients, build smooth ramps between brand colours, or pick a colour that splits the difference between two brand candidates. Our free color mixer outputs every interpolation point as HEX, with a 7-step preview ramp and copy-ready values.

    Mixing two colours mathematically is one of those operations everyone needs occasionally and few people do well by eye. Designers reach for it when picking a button hover state (“I need something between my brand purple and pure black”), when building gradient stops, when matching a competitor’s colour to a brand-adjacent variant. The naive approach — averaging the RGB values — works for greys but produces muddy results across distant hues. A good color mixer uses perceptually-uniform colour spaces to give you mid-points that look halfway between the two inputs.

    Our color mixer tool takes two HEX inputs and produces a 7-step interpolated ramp, with a slider you can drag for any specific blend ratio. Output formats include HEX, RGB, HSL, and OKLCH for the interpolation modes that support it. This guide explains what each interpolation mode does, when to pick which, and the workflows where colour mixing solves real design problems.

    Three interpolation modes — RGB, HSL, OKLCH

    Mode How it interpolates Best for
    RGB Linear blend of R, G, B channels independently Greys, subtle shifts between similar colours
    HSL Hue rotates through colour wheel; saturation + lightness blend linearly Rainbow-style mid-points, dramatic colour blends
    OKLCH Perceptually uniform — equal slider distance = equal visual change Most balanced ramps; the modern best practice for design systems

    Why the same input produces different mid-points in each mode. Mix red #FF0000 and blue #0000FF:

    • RGB mid-point: #800080 (purple) — the literal R/G/B average. Looks dark and muddy.
    • HSL mid-point (shorter hue arc): #FF00FF (magenta) — rotates through the magenta side of the wheel. Vivid.
    • HSL mid-point (longer hue arc): #00FF00 (green) — rotates through cyan and green the long way around. Wild.
    • OKLCH mid-point: #A53C7C (warm magenta-purple) — perceptually balanced, neither washed-out nor neon.

    For everyday design work, OKLCH produces the answer most designers would call “right”. RGB is fine for similar colours; HSL is best when you specifically want the mid-point to traverse vivid colours (rainbow gradients, cyberpunk aesthetics).

    Five workflows where a color mixer earns its keep

    • Picking a button hover state. Mix your brand colour with a darker variant (often pure black or your darkest neutral) at 15-25% to get a hover state that reads as “same colour, more pressed”.
    • Building gradient stops. A two-colour gradient with a manually-mixed middle stop reads better than a default browser gradient — especially for distant hues where browsers’ sRGB interpolation produces muddy mid-points.
    • Bridging brand colours. If your design system has two brand colours (primary blue + accent orange, say) and you need a third for a specific component, a 50/50 mix gives you a colour that “feels” like it belongs to both.
    • Match-mode A/B test colours. Mix your existing CTA colour with the test variant at 25%, 50%, 75% to design a smooth visual A/B test rather than a jarring switch.
    • Theme transition colours. When transitioning between light and dark mode, the mid-point colour for borders, surfaces, and shadows often needs to be hand-picked. A mixer between the two extremes gives you the right mid-tone.

    How to use the browser color mixer

    1. Open the color mixer
    2. Enter two HEX values (or use the colour pickers) — your start and end colours
    3. Pick the interpolation mode: RGB, HSL, or OKLCH (default OKLCH for balanced ramps)
    4. The 7-step ramp renders instantly. Each step shows its HEX value
    5. Drag the slider to any specific blend ratio (0% = start, 100% = end, 50% = midpoint) for fine control
    6. Click any swatch to copy its HEX. Or click “Copy all” to grab the entire ramp as comma-separated HEX values

    Switch interpolation mode with the same inputs — the ramp re-renders showing the difference. Doing this once visually clarifies why OKLCH is the modern default: the colours look more “evenly spread” between the start and end than either RGB or HSL.

    Mixing colours in code

    JavaScript (colord library):

    import { colord } from "colord";
    
    // 50/50 mix of red and blue
    const mid = colord("#FF0000").mix("#0000FF", 0.5).toHex();
    // => "#800080" (RGB blend)
    
    // Build a 5-step ramp
    const ramp = [0, 0.25, 0.5, 0.75, 1].map((t) =>
      colord("#FF6B6B").mix("#4ADE80", t).toHex()
    );

    Modern CSS (color-mix() function — supported in Chrome 111+, Safari 16.2+, Firefox 113+):

    /* 50/50 mix in OKLCH (perceptually uniform) */
    .button:hover {
      background: color-mix(in oklch, var(--brand) 75%, black 25%);
    }
    
    /* 30/70 mix in RGB */
    .divider {
      background: color-mix(in srgb, #635BFF 30%, white 70%);
    }

    Python (colormath):

    from colormath.color_objects import sRGBColor, LabColor
    from colormath.color_conversions import convert_color
    
    a = sRGBColor.new_from_rgb_hex("#FF6B6B")
    b = sRGBColor.new_from_rgb_hex("#4ADE80")
    la, lb = convert_color(a, LabColor), convert_color(b, LabColor)
    
    # 50/50 in Lab (perceptually uniform)
    mid_lab = LabColor(
        (la.lab_l + lb.lab_l) / 2,
        (la.lab_a + lb.lab_a) / 2,
        (la.lab_b + lb.lab_b) / 2,
    )
    print(convert_color(mid_lab, sRGBColor).get_rgb_hex())

    The color-mix() CSS function is the modern way — no JavaScript needed. Use it directly in your stylesheets and the browser computes the mix at render time. ~94% global support as of 2026.

    Common mistakes when mixing colours

    • Mixing two colours that produce a muddy mid-point. Distant hues (red-blue, yellow-purple) often have washed-out RGB mid-points. Switch to OKLCH or HSL for vibrant results.
    • Forgetting to test contrast at every step. A start colour that passes WCAG against your text and an end colour that also passes don’t guarantee every step in between passes. Audit accessibility across the full ramp before shipping.
    • Using HSL longer hue arc by default. The longer-arc rotation is dramatic and rarely what designers actually want. Default to shorter arc (the standard) and only switch to longer for explicit rainbow effects.
    • Mixing in the wrong colour space for print. Screen-to-print conversion already loses gamut accuracy. Don’t add interpolation noise on top — pick the print colours directly from a Pantone-aware palette.

    When NOT to mix colours

    • For your primary brand palette. Brand colours should be specified, not mixed. The mixer is for finding adjacent or transitional colours, not the brand itself.
    • For accessibility-critical text on coloured backgrounds. Mixed colours often hover near contrast thresholds. Use Tailwind’s pre-tuned ramps where every step is verified for contrast against neutral text.
    • For colour systems requiring CMYK accuracy. Mixing in RGB then converting to CMYK accumulates errors. Mix directly in CMYK in print-aware tools.

    Frequently asked questions

    What’s the difference between mixing colours and gradients?

    A colour mixer produces discrete colour values at specific blend ratios (good for picking exact colours for use in CSS or design tokens). A gradient produces a continuous visual transition between colours (good for backgrounds, hero sections, button fills). They use the same underlying interpolation math; the difference is whether the output is a discrete value or a smooth transition.

    Should I use RGB, HSL, or OKLCH for mixing?

    OKLCH for perceptual uniformity (the default modern best practice). HSL for vivid mid-points (the colours pass through more saturated regions). RGB for similar colours where the difference is small. For most design system work, OKLCH gives you the answer that matches “the eye’s average” and avoids muddy mid-points or unexpected hue shifts.

    Why does my CSS color-mix() result look different from the tool?

    The color-mix() CSS function defaults to in oklab if you don’t specify a colour space. Our tool defaults to oklch which produces slightly different results than oklab. Match the spaces explicitly: color-mix(in oklch, ...) in CSS for results identical to the tool.

    Can I mix more than two colours?

    Not in a single mix operation — colour mixing is fundamentally pairwise. To blend three colours, mix the first two together, then mix that result with the third. Or use a multi-stop gradient and sample colours from specific positions, which is what 3-colour gradient generators effectively do.

    Is the mixed colour the same as a 50% opacity overlay?

    Visually similar but mathematically different. Mixing produces a single new colour. A 50% opacity overlay shows whatever’s behind through the semi-transparent overlay, so the visual result depends on the background. For a fixed white background, an opacity-50 red overlay and a 50/50 mix of red and white look identical. Over a different background, the opacity overlay produces a different visible colour.

    Does the tool support the alpha channel?

    The current mixer focuses on opaque colour interpolation. For alpha-aware mixing (where you blend two semi-transparent colours), use color-mix() in CSS with explicit alpha values, or use the colord library’s .alpha() method in JavaScript.

    Related tools and guides

     

  • Color Shades Generator: Build a Tailwind 50-950 Ramp [2026]

    Color Shades Generator: Build a Tailwind 50-950 Ramp [2026]

    TL;DR: A color shades generator turns one base colour into an 11-step ramp — 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950 — the same scale Tailwind CSS, Material Design, and most modern design systems use. Our free generator outputs HEX, RGB, HSL, and (modern) OKLCH for every step, with Tailwind config and CSS variable export ready to paste.

    The single most useful primitive in modern UI design is the colour ramp — a series of related shades from one base colour, evenly spaced by perceived lightness. Tailwind ships ~22 of them out of the box (slate, gray, zinc, neutral, stone, red, orange, amber, yellow, lime, green, emerald, teal, cyan, sky, blue, indigo, violet, purple, fuchsia, pink, rose). When you build a custom design system on top of Tailwind — or any token-based design system — you need ramps for your brand colours that match Tailwind’s spacing exactly, so they slot into the same components without rewriting CSS.

    Our color shades generator takes any HEX input and produces an 11-step ramp aligned to the Tailwind 50-950 scale. The output exports as a Tailwind config block, CSS custom properties, or a flat HEX list. This guide explains the math behind perceptually uniform ramps, the reason naive lighten/darken produces bad mid-tones, and the workflows that turn one brand colour into a complete usable palette.

    What does each step on the 50-950 scale represent?

    Step Lightness Typical use
    50 Near-white tint Page backgrounds, subtle alternating-row stripes
    100 Very light tint Hover states for tertiary buttons, light card backgrounds
    200 Light tint Borders, dividers, disabled-state fills
    300 Soft tint Placeholder text on dark backgrounds, secondary borders
    400 Medium-light Secondary text, subtitles, captions
    500 Base / brand Primary buttons, links, brand accents — your starting colour
    600 Slightly darker Button hover states, focus rings
    700 Dark Active button states, secondary headings
    800 Deep Body text on light backgrounds, primary headings
    900 Very deep Dark-mode backgrounds, deepest text
    950 Near-black Maximum-contrast text, dark-mode primary surfaces

    The 11-step scale isn’t arbitrary — it’s perceptually-spaced so each adjacent pair has roughly the same WCAG contrast ratio against a fixed reference. That means you can swap one ramp for another (your brand purple for Tailwind’s indigo, say) and existing components keep working without contrast failures.

    Why naive lighten/darken produces bad ramps

    The intuitive way to build a ramp is “blend my base colour with white for tints, blend with black for shades”. This works for grey but fails for any saturated hue. Mixing pure red with white in RGB produces washed-out pink, not a brighter red. Mixing red with black produces a muddy maroon, not a darker red. The shifts happen because RGB blending traverses the colour cube linearly — but human perception of “lighter” and “darker” doesn’t follow the cube’s diagonal.

    Three approaches, increasing fidelity:

    • HSL lightness adjustment. Convert to HSL, change only the L value. Better than RGB blending — preserves hue. The default approach for most older tools.
    • HCL / OKLCH adjustment. Convert to OKLCH (perceptually uniform colour space), change only the L value. Produces ramps where each step looks like an equal step to your eye, regardless of hue. The modern best practice.
    • Manually-tuned per-hue. What Tailwind does internally — each step in their ramps is hand-adjusted for chroma and hue alongside lightness, so deeply saturated reds and pale yellows both produce balanced ramps. Hard to reproduce automatically; our tool gets close with OKLCH.

    Our generator uses OKLCH interpolation by default, which produces ramps that match Tailwind’s hand-tuned ramps within ~5% perceived lightness at every step. For 99% of design system work, that’s indistinguishable from manual tuning.

    How to use the browser color shades generator

    1. Open the color shades generator
    2. Type or paste your base HEX (e.g., #635BFF) into the input. The 11-step ramp renders instantly
    3. Switch the output format between HEX, RGB, HSL, and OKLCH — the values for every step update live
    4. Click any swatch to copy its HEX value to your clipboard
    5. Click Copy Tailwind config to get a paste-ready block:
      colors: { brand: { 50: '#...', 100: '#...', ... 950: '#...' } }
    6. Or click Copy CSS variables for a custom-property block ready to drop into :root

    Adjust the optional ramp-strength slider for tighter or looser tonal spread. The default produces a Tailwind-aligned ramp; pushing strength higher makes the 50 and 950 steps more extreme.

    Generating ramps in code

    JavaScript / TypeScript (colord library):

    import { colord } from "colord";
    
    function buildRamp(baseHex) {
      const base = colord(baseHex);
      const steps = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
      const ramp = {};
      steps.forEach((step, i) => {
        const offset = (i - 5) / 5; // -1 (lightest) to +1 (darkest)
        const c = offset === 0
          ? base
          : offset < 0
            ? base.lighten(Math.abs(offset) * 0.5)
            : base.darken(offset * 0.45);
        ramp[step] = c.toHex();
      });
      return ramp;
    }
    
    console.log(buildRamp("#635BFF"));
    // => { 50: "#f4f3ff", 100: "#e7e5ff", ..., 950: "#1a1849" }

    Python (with the colormath library):

    from colormath.color_objects import sRGBColor, LCHabColor
    from colormath.color_conversions import convert_color
    
    def hex_to_ramp(hex_color):
        base = sRGBColor.new_from_rgb_hex(hex_color)
        lch = convert_color(base, LCHabColor)
        ramp = {}
        for i, step in enumerate([50,100,200,300,400,500,600,700,800,900,950]):
            # Adjust L (lightness) channel; keep C and H constant
            new_l = max(5, min(95, lch.lch_l + (5 - i) * 9))
            new = LCHabColor(new_l, lch.lch_c, lch.lch_h)
            ramp[step] = convert_color(new, sRGBColor).get_rgb_hex()
        return ramp

    Building a multi-colour design system from ramps

    One ramp is a primary brand colour. A complete design system needs at least four ramps:

    • Primary (your brand): the colour everyone associates with your product. Used for CTAs, links, hero accents.
    • Neutral (gray ramp): for body text, borders, surfaces. Most products use Tailwind’s slate or zinc directly.
    • Success (green): for confirmation states, completed actions. Tailwind’s emerald ramp is a sensible default.
    • Danger / error (red): for destructive actions, validation errors. Tailwind’s red works.

    Optional but useful: a warning ramp (yellow/amber), an info ramp (blue), and a “muted” surface ramp distinct from neutral. Most polished design systems land at 6-8 named ramps, with each ramp providing the full 50-950 scale.

    The four mistakes that produce bad ramps

    • Using a base that’s too dark. If your brand HEX is #0A2540 (very dark navy), the lightening process produces washed-out 50-100 steps that all look essentially grey-white. Pick a brand colour around the 500 range (mid-saturation, mid-lightness) for the cleanest ramps.
    • Mixing colour spaces inside one design system. If your primary ramp uses OKLCH and your neutral uses HSL, the perceived spacing between steps differs subtly across colours. Pick one method and apply it to all ramps.
    • Forgetting accessibility at the extremes. The 50 step might fail contrast against pure white; the 900 step might have less than 4.5:1 against another dark colour. Always test the actual contrast ratios in real component contexts.
    • Hard-coding HEX values everywhere instead of variables. Once your ramps are defined, reference them via Tailwind utility classes or CSS custom properties. Hard-coding lets the next designer quietly drift away from the system.

    When NOT to auto-generate a ramp

    • For brand-critical primary colours. If your brand identity is built around a specific shade, hand-tune the entire ramp in OKLCH to match the brand book exactly. Auto-generators are starting points, not final palettes.
    • For greyscale neutrals. Auto-generated grey ramps from a base often produce blue-tinged or warm-tinged greys. Use Tailwind’s pre-tuned slate, gray, zinc, neutral, or stone directly.
    • For accessibility-strict environments. Government, healthcare, education sites need ramps where every step pair passes WCAG AAA contrast. Auto-generated ramps need manual nudging at the extremes.
    • For print colour systems. Print uses CMYK, has different contrast behaviour, and benefits from Pantone-matched ramps designed in print-aware tools.

    Frequently asked questions

    Why does Tailwind use 50-950 instead of 100-1000?

    Tailwind inherited the 50-900 scale from Google Material Design, which originally used 50, 100-900 in 100-step increments. Tailwind v3 added 950 (a near-black step, useful for dark-mode primary surfaces). The scale is convention more than precise math — what matters is consistency across your design system.

    Can I export the ramp directly into my Tailwind config?

    Yes. Click “Copy Tailwind config” in the tool — it produces a paste-ready colors: { brand: {...} } object. Drop it into your tailwind.config.js under theme.extend.colors. The values become available as utilities (bg-brand-500, text-brand-700, etc.) immediately after a build.

    Should I use HEX, RGB, HSL, or OKLCH for my ramp output?

    HEX for compatibility — every system understands it. RGB if you’re integrating with a tool that requires RGB values explicitly. HSL if you’ll be making programmatic tweaks (changing all your ramps’ lightness in tandem). OKLCH if you’re targeting modern browsers exclusively and want the most perceptually-uniform colour math available — supported in Chrome 111+, Safari 16.4+, Firefox 113+.

    How does the tool handle very light or very dark base colours?

    For very light bases (e.g., a pastel yellow), the 50-100 steps clip to near-white because there’s nowhere lighter to go. For very dark bases (deep navy, near-black), the 800-950 steps clip toward solid black. The cleanest ramps come from base colours in the mid-lightness range (HSL L between 40-60). If your brand colour is at an extreme, the tool produces the best ramp possible but it’ll be compressed at one end.

    What’s the difference between tints, shades, and tones?

    Tints are mixes with white (lighter versions of the base). Shades are mixes with black (darker versions). Tones are mixes with gray (less saturated versions). Most “shades generators” produce a combination of all three implicitly via OKLCH lightness adjustment, which traverses both tint and shade directions while preserving saturation.

    Can the generator handle dark-mode ramps?

    Yes — the same ramp works for both light and dark mode. You typically use lower steps (50-200) as backgrounds in light mode, and higher steps (800-950) as backgrounds in dark mode. Switch with CSS @media (prefers-color-scheme: dark) or a class toggle. One ramp, two modes.

    Related tools and guides

     

  • Image Color Picker Tool: Sample HEX, RGB & HSL [2026]

    Image Color Picker Tool: Sample HEX, RGB & HSL [2026]

    TL;DR: An image color picker tool samples the exact colour of any pixel from an uploaded photo and converts it to HEX, RGB, HSL, and CMYK. Designers use it to extract brand palettes, match a website’s accent to a hero photo, or steal the perfect blue from a sunset shot. Our browser-based image color picker processes the photo locally — no upload, no signup, click anywhere on the image to sample.

    The fastest way to find a colour you can describe but can’t name: photograph it (or screenshot it) and run an image color picker over it. Brand designers do this with mood-board photos. Frontend developers do it when matching a CSS background to a hero image their team’s photographer captured. Print designers do it before specifying CMYK values for a poster run. The photo holds the colour information at full precision; an image color picker translates that into the format your CSS, design tool, or print spec actually uses.

    Our image color picker tool reads the photo via your browser’s canvas API and extracts the exact RGB values of any pixel you click. It outputs in HEX, RGB, HSL, HSV, and CMYK simultaneously, with one-click copy on each format. The photo never uploads — useful for proprietary brand work, NDA-protected mockups, or anything you’d rather keep off third-party servers.

    The five colour formats and when each is right

    Format Example Use for
    HEX #635BFF CSS, brand guidelines, design tools — the universal web colour notation
    RGB rgb(99, 91, 255) Programming (every image library uses RGB), some legacy CSS
    HSL hsl(244, 100%, 68%) Building palettes — easier to derive lighter/darker shades by adjusting one number
    HSV hsv(244, 64%, 100%) Photoshop and Affinity Photo’s default colour picker — useful for matching design files
    CMYK cmyk(61%, 64%, 0%, 0%) Print — magazine, brochure, business card. Different gamut from RGB; expect approximation

    Why HSL is the designer’s secret weapon. Once you have a colour in HSL, you can build an entire palette by changing only the lightness. hsl(244, 100%, 68%) with the lightness pushed to 90% becomes a soft tint suitable for a card background; pushed to 30% becomes a deep shade for hover states. RGB and HEX don’t expose this control as cleanly — adjusting them to a perceived lighter/darker version requires multiple channel changes that often shift the hue.

    The CMYK caveat. Computer screens use additive RGB; printers use subtractive CMYK. The two colour spaces don’t perfectly align — vivid screen blues, oranges, and greens often can’t be reproduced in print. The CMYK output from a screen-photo color picker is an approximation; for production print work, ask your printer for their colour-managed conversion (they’ll use ICC profiles to map RGB → CMYK accurately).

    Five common workflows for an image color picker

    • Brand palette extraction. Drop your company’s hero photo into the tool, click on the four or five distinctive colours. Save those as the starter palette for your design system.
    • Matching website accents to imagery. When a marketing photo dominates a landing page, the CTA buttons and section backgrounds look better when they pull from the photo’s palette. Sample from the photo first, then build the CSS.
    • Reproducing a competitor’s colour. Found a colour you like on someone else’s site or in a magazine? Screenshot, drop into the picker, copy the HEX. Faster than guessing and far more accurate than a paper colour wheel.
    • Print colour matching. Photograph a paint chip or fabric swatch under daylight, sample it, and use the result as the starting CMYK for a printed brochure. Calibrate against the actual print sample for accuracy.
    • Accessibility audits on photos. Sample the dominant colour of a photo behind text. Run the WCAG contrast check against your text colour. If it fails, you know exactly which photo region needs an overlay.

    How to use the browser image color picker

    1. Open the image color picker
    2. Drop your photo onto the dropzone, or click to pick from disk
    3. The image renders in a zoomable canvas. Use scroll-wheel or pinch to zoom in for pixel-precision sampling
    4. Click anywhere on the image to sample — the HEX, RGB, HSL, HSV, and CMYK values appear instantly with a swatch preview
    5. Click the copy icon next to any format to grab that exact value to your clipboard
    6. Sample additional pixels by clicking new locations — each sample stays in your history sidebar for easy comparison

    Everything happens client-side via the canvas getImageData API. The photo never uploads, the sampled colour never transmits.

    Sampling colours in code

    Browser JavaScript (canvas getImageData):

    const canvas = document.createElement("canvas");
    const img = new Image();
    img.crossOrigin = "anonymous";
    img.onload = () => {
      canvas.width = img.naturalWidth;
      canvas.height = img.naturalHeight;
      const ctx = canvas.getContext("2d");
      ctx.drawImage(img, 0, 0);
    
      // Sample pixel at coordinates (x, y)
      const [r, g, b, a] = ctx.getImageData(x, y, 1, 1).data;
      const hex = "#" + [r, g, b].map(n => n.toString(16).padStart(2, "0")).join("");
      console.log(hex);
    };
    img.src = "/path/to/photo.jpg";

    Node.js (Sharp + raw pixel access):

    import sharp from "sharp";
    
    const { data, info } = await sharp("photo.jpg")
      .raw()
      .toBuffer({ resolveWithObject: true });
    
    const idx = (y * info.width + x) * info.channels;
    const [r, g, b] = [data[idx], data[idx + 1], data[idx + 2]];
    console.log(`rgb(${r}, ${g}, ${b})`);

    Python (Pillow):

    from PIL import Image
    
    img = Image.open("photo.jpg")
    r, g, b = img.getpixel((x, y))[:3]
    print(f"#{r:02x}{g:02x}{b:02x}")

    The four mistakes that produce the wrong colour

    • Sampling JPEG artefact pixels. JPEG compression creates colour noise around hard edges. A pixel sampled at the boundary between a logo and its background often has a “halo” colour that doesn’t match either neighbour. Sample 10-20 pixels into the solid region.
    • Trusting screenshots over the source. If you screenshot a website to sample its CSS colour, your screen’s colour profile, your monitor’s calibration, and macOS/Windows’s gamma all shift the values. Use browser DevTools’ eyedropper directly on the live element instead.
    • Mixing up sRGB and Display P3. Modern Macs and iPhones photograph in Display P3 colour space, which encodes vivid colours that sRGB can’t reach. A picker that assumes sRGB on a P3 photo returns desaturated values. Most browser tools handle this automatically, but be aware when results look slightly off.
    • Sampling backlit or shadowed regions. A subject’s shirt looks bright pink in direct sun, dim pink in shade. The “real” colour exists somewhere in between — for brand work, photograph in even diffused light or sample multiple regions and average them.

    When NOT to use a single-pixel color picker

    • For palette extraction from complex photos. A single pixel doesn’t represent a photo’s overall colour story. Use a dominant-colour or palette-extractor tool that analyses the whole image. (We have one: the Image Color Extractor.)
    • For accessibility-grade colour matching. WCAG contrast calculations need precise colour values. A single sample can hit a JPEG artefact pixel; sample 20 and average for accuracy.
    • For print colour proofing. The CMYK approximation from a screen photo is rough. Order a printed proof or ask your printer for an ICC-managed conversion.
    • From low-resolution or heavily-compressed sources. A 200×200 thumbnail saved at JPEG quality 50 has bands of false colour everywhere. Source a higher-res copy if you need accurate colours.

    Frequently asked questions

    What’s the difference between an image color picker and a screen color picker?

    An image color picker samples colours from a static image you upload. A screen color picker (like Chrome DevTools’ eyedropper or macOS Digital Color Meter) samples colours directly from any pixel on your screen, including live web pages. For sampling a colour from a photo, image color picker. For sampling a CSS colour from a competitor’s live site, screen picker.

    Can I get the dominant colour of an entire image?

    Not from a single-pixel picker. Use our dedicated Image Color Extractor which analyses the whole image and returns the top 5-8 dominant colours plus a perceptual palette suitable for design systems.

    Why does my sampled HEX not match the colour I expected?

    Three common causes: (1) JPEG artefacts producing false colours near edges — sample further into solid regions; (2) your monitor’s calibration shifting how colours display; (3) the source photo using Display P3 colour space which encodes wider gamut than sRGB. For brand work, sample multiple pixels in the same region and use the median value.

    Is my photo uploaded when I use the picker?

    No. The browser reads the photo via the File API, draws it on a canvas, and reads pixel data from the canvas — all without making any network requests. Verify in DevTools’ Network tab. The photo and any sampled colours stay on your device.

    Can I sample colours from a website screenshot?

    Yes — drop the screenshot into the picker like any other image. For higher accuracy though, use Chrome DevTools or browser extensions that sample directly from the live page (avoiding screenshot compression). Both Chrome and Firefox have built-in eyedroppers in their colour pickers.

    Does the tool work on transparent PNGs?

    Yes. Transparent regions return alpha = 0 in the sample readout, with the underlying pixel colour shown for reference. If you click on a transparent pixel and want the colour you’d see (white if displayed on white), composite the image first or sample a non-transparent neighbour.

    Related tools and guides