Tag: Design

  • 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