Color

Color picker: HEX, RGB, image pixels and saved swatches

·

Choose a color from a supported value, channel controls, a local image or an available browser screen picker. ToolMellow shows six formats and lets you keep useful swatches in the current page.

This guide explains alpha precision, original-pixel sampling, image limits, palette percentages and exports, including which actions clear state and which require sampling again.

Color picker

Choose a color, inspect its values and keep useful swatches

Use Color Picker to enter a CSS color, adjust its channels, sample a local image or choose a screen color when the browser offers that feature. The current color has six copyable representations, and saved swatches provide a temporary collection for the current page.

The initial color is #7D9065, or rgb(125, 144, 101), with alpha 1. Loading an image does not automatically replace it, sample a pixel or extract a palette. Start with the operation you need, then inspect the resulting value before copying or saving it.

A useful color code describes a particular representation. It does not establish how a display is calibrated, how ink will print or whether text has enough contrast. Compare the actual foreground and background separately when readability matters.

HTML Color Codes: color-picker terminologyImageColorPicker: image color-code terminology

Enter the supported HEX, named, RGB and HSL forms

The HEX field accepts an optional # and 3, 4, 6 or 8 hexadecimal digits, ignoring surrounding spaces. Short forms expand and letters normalize to uppercase: #0f08 becomes #00FF0088. The RGB or HSL field also accepts HEX, CSS color names and transparent, plus supported numeric RGB/RGBA/HSL/HSLA syntax.

This is a supported sRGB input subset rather than a complete CSS evaluator. RGB channels may be numbers or percentages and must stay in range; the parser rounds them to integer channels instead of applying all CSS clamping rules. Text HSL saturation and lightness require percentages. The color-text field is capped at 200 UTF-16 code units.

Enter the supported HEX, named, RGB and HSL forms
InputExample or ruleMeaning or boundary
3-digit HEX#0f0Expands to opaque green
4-digit HEX#0f08Expands RGB and alpha
6-digit HEX#0C2238Opaque RGB
8-digit HEX#0C223880RGB plus 8-bit alpha
CSS named colorrebeccapurple148 named values; case-insensitive
TransparenttransparentBlack with zero alpha
Numeric RGB or HSLComma forms or space/slash formsIncludes rgba/hsla; finite values in supported ranges
Other CSS expressionscurrentcolor, var(), calc(), lab(), display-p3Not evaluated by this tool

CSS Color Level 4: hexadecimal sRGB notation

Understand decimal alpha and HEX rounding

Alpha 0 is fully transparent and alpha 1 is opaque. RGB and HSL retain the current decimal alpha, while HEX rounds it to the nearest of 256 byte values. For example, rgba(12, 34, 56, 0.5) produces #0C223880; reading that HEX back gives alpha 128/255, approximately 0.501961, rather than exactly 0.5.

Copy the representation appropriate for your destination. HSL and RGB-percent channels use up to three decimal places, and normalized RGBA channels up to four. The Alpha number control shows up to six decimal places; RGB and HSL outputs retain the stored decimal alpha. Re-entering a rounded representation can change the underlying value. Two decimal alpha values can share the same HEX code without being the same saved swatch.

CSS Color Level 4: hexadecimal sRGB notation

Adjust channels and copy one of six formats

Change R, G and B within 0–255 and alpha within 0–1. HSL controls expose hue in degrees and saturation/lightness percentages; textual hue accepts deg, grad, rad and turn and normalizes finite angles. The visual color chooser changes RGB while preserving the current alpha.

Each Copy button copies its entire displayed representation. The CSS-variable format creates a declaration to place in your own stylesheet; it does not resolve var() input. If clipboard access fails, select the displayed value and copy it manually.

Adjust channels and copy one of six formats
FormatExample at decimal alpha 0.5Use
HEX#0C223880Compact RGB plus quantized alpha
RGBrgba(12, 34, 56, 0.5)Integer channels with decimal alpha
HSLHue, saturation, lightness and alphaAdjust color using HSL
RGB percentrgb(4.706% 13.333% 21.961% / 50%)Percentage-channel CSS
Normalized RGBA0.0471, 0.1333, 0.2196, 0.5Normalized numeric channels
CSS variable--color: rgba(12, 34, 56, 0.5);Custom-property declaration

CSS Color Level 4: hexadecimal sRGB notation

Read the preview and recover from invalid input

The main preview is composited on white. A transparent color therefore looks different here from the same color over a dark page. The preview backing is separate from the image sampler’s backdrop; changing the sampling backdrop does not change the main preview’s white backing.

Invalid HEX, CSS text or channel input leaves the last valid color visible. Current-format copying and Save swatch are disabled so that the preview is not mistaken for a conversion of invalid text. Correct the input or restore a saved swatch to recover. Previously saved swatches and their downloads are separate from the invalid current input.

HTML Standard: the 2D canvas rendering context

Load a supported local image within the limits

Choose a local JPG, PNG or still WebP file, or paste an image file into the paste area. The tool checks the file header before browser decoding. It rejects unsupported formats, detected animated PNG/WebP and files beyond the independent size or dimension limits.

Sampling reads browser-decoded sRGB canvas pixels, not the encoded file’s original channel bytes. Browser decoding, transparency and color management can affect the result. Use a color-managed imaging or print workflow when you need profile-specific measurements, CMYK separation or a print proof.

Load a supported local image within the limits
PropertyLimit or supportPractical meaning
FormatsJPG, PNG, still WebPChoose a supported local image
File size25,000,000 bytesDecimal 25 MB
Decoded pixels24,000,000Width multiplied by height
Each side12,000 pixelsWidth and height checked separately
AnimationDetected APNG/animated WebP rejectedUse a still image
Displayed imageFits within 900 × 450Sampling coordinates still refer to the original image

HTML Standard: the 2D canvas rendering context

Select an original pixel with coordinates or keys

Click the image, enter its X and Y coordinates, or focus it and use the arrow keys. Coordinates are zero-based: the upper-left pixel is X 0, Y 0. The last valid coordinates are width minus one and height minus one, even when the displayed image has been scaled down.

Arrow keys move one original pixel; Shift plus an arrow moves ten, clamped to the image edge. Enter or Space samples the selected pixel, and Sample selected pixel offers the same explicit action. The 6×, 12× and 20× magnifier helps inspect the neighborhood without changing the original coordinate system.

Keep sampled alpha or composite on a backdrop

By default, Keep sampled alpha is off and the sampling backdrop is white. A partially transparent pixel is composited on that backdrop and returned as an opaque color. Turn the option on to retain the decoded pixel’s alpha instead. The resulting main preview still shows that color over white.

Changing the checkbox or backdrop does not resample the main color automatically. Sample again to apply the new choice. Changing the backdrop also clears the extracted palette. Palette extraction always composites visible pixels on its backdrop, regardless of the sampled-alpha checkbox.

Extract an approximate palette and interpret percentages

Choose 2, 3, 4, 5, 6, 8, 10 or 12 colors, then select Extract palette. The initial request is six. The image is reduced to a sample within 256 × 256, and colors are grouped into 4-bit-per-channel RGB buckets. The selected bucket colors are averages, so the palette is an approximate summary rather than an inventory of every original color.

Fully transparent pixels are ignored; partially transparent pixels are composited on the backdrop and counted. Percentages use all visible sampled pixels as the denominator. Selecting only the largest buckets can total less than 100%, and an image with fewer occupied buckets returns fewer colors than requested. Extraction alone does not replace the current color or save swatches; selecting a palette color does both.

ImageColorPicker: image color-code terminology

Keep up to 24 swatches in this page

Use Save swatch after a manual edit to remember the current value. Picking an image pixel, selecting an extracted palette color or receiving a screen-picker result remembers that color automatically. Newest swatches appear first, duplicate RGB/RGBA serializations are not added again, and only the latest 24 unique values remain.

Select a saved swatch to restore it. Decimal alpha participates in its identity, so values such as alpha 0.5 and 0.50001 can remain separate even if both round to the same HEX alpha byte. These swatches live in page memory; they are not a persistent project or a collection that survives a reload.

Download saved swatches or the extracted palette

Saved swatches download as toolmellow-swatches.json with r, g, b, a and hex fields, or toolmellow-swatches.css with --swatch-N RGB/RGBA custom properties inside :root. JSON retains the decimal alpha value while its HEX field has byte-rounded alpha. The file contains the current saved list in newest-first order.

The extracted palette has separate Copy HEX, JSON, CSS and TXT actions. Downloads are toolmellow-palette.json, toolmellow-palette.css and toolmellow-palette.txt. JSON contains hex and percent, CSS uses --palette-N HEX declarations, and TXT/Copy HEX use newline-separated HEX values. Copy failure offers the palette download as an alternative.

Use Pick from screen when your browser provides it

Pick from screen appears when EyeDropper is exposed by the browser. The API needs a supported browser environment and a secure context, and starts from your button action. Its selected sRGBHex result is opaque, replaces the current color and is remembered as a swatch.

Cancelling the browser picker is handled quietly; another invocation aborts the preceding request, and leaving the workspace aborts a pending request. Other failures show a notice offering manual values or a local image. The saved application checks used controlled API callbacks; they do not establish successful physical screen selection or support across browsers.

EyeDropper API: browser screen-color selection

Know what clears and what stays

Treat the current color, loaded image, extracted palette and saved swatches as separate pieces of state. Clear image also invalidates a pending image load, so a late decode should not bring back an image you already removed. The checked delayed-decode fixtures verified clearing and out-of-order replacement in those controlled cases.

Download what you need before reloading or leaving. Clear actions do not erase copied clipboard values or files already saved on your device, and a page-memory swatch list is not a backup.

Know what clears and what stays
ActionCleared or changedRetained
Load another imageImage and extracted paletteCurrent color, saved swatches and sampler options
Change sampled-alpha optionOption for the next sampleCurrent color until sampled again
Change sampling backdropBackdrop and extracted paletteCurrent color until sampled again
Change requested palette sizeExtracted paletteImage, current color and saved swatches
Clear imageImage, palette, sampler notice/error; pending load invalidatedCurrent color, saved swatches and sampler options
Clear swatchesSaved swatch listCurrent color, image and extracted palette
Reload pageAll page-memory workspace state resetPreviously copied or downloaded values outside the page

A practical workflow for reusing a color

Start with a known color code when you need a precise input representation, or a local image when you need a decoded pixel sample. Choose whether transparency should be retained or composited before sampling, and inspect both the numeric value and the context where you will use it.

For a small design palette, extract approximate colors, select useful ones into saved swatches and export the collection. Check contrast and the actual target rendering separately. A palette percentage or a pleasing preview does not establish readability or print accuracy.

  • Enter a supported value or load a supported local image.
  • For an image, select the original X/Y pixel and choose the alpha/backdrop behavior.
  • Sample again after changing an alpha or backdrop option.
  • Inspect the six formats and copy the representation your destination expects.
  • Save useful manual colors; sampled colors are remembered automatically.
  • Export the correct swatch or palette collection before reloading.

Local processing, loading and common problems

Color parsing, canvas sampling, palette calculation and file creation run in the browser. The checked local workflows made no external requests and sent no selected color or image content as requests. Page assets still need to load; this observation does not guarantee an offline first visit or identical results in every browser.

If a color is refused, simplify it to one of the supported numeric or named forms and check its ranges. If an image fails, check its actual format, animation and independent byte/pixel/side limits, then choose it again. If a sampled color seems unchanged, sample after changing the backdrop or alpha option. Use manual input or a local image if screen picking is unavailable.

HTML Standard: the 2D canvas rendering context

Frequently asked questions

What color formats can I enter?

Use optional-# HEX with 3, 4, 6 or 8 digits; 148 CSS named colors; transparent; or supported numeric RGB/RGBA/HSL/HSLA comma or space/slash forms. This is not a general evaluator for var(), calc(), currentcolor, lab() or display-p3.

Why does invalid input keep the last valid preview?

The last valid color remains visible so an invalid edit does not discard it. Current-format Copy and Save swatch stay disabled until you correct the input or restore a valid saved swatch.

Why does HEX alpha differ from decimal alpha?

HEX stores alpha in 8 bits while RGB and HSL retain decimal alpha. Decimal 0.5 rounds to HEX80, whose decoded value is 128/255, approximately 0.501961. Re-entering rounded values can therefore change alpha.

Does the visual color picker preserve alpha?

Yes. The visual color input changes RGB while keeping the current alpha. An EyeDropper screen result is different: it supplies an opaque sRGBHex color.

How do I pick an original image pixel?

Click the image, enter zero-based X/Y coordinates or focus it and use arrows. Shift plus an arrow moves ten original pixels; Enter, Space or Sample selected pixel samples. Scaling the display or magnifier does not change the original coordinate system.

Does changing the sampling backdrop resample my selected color?

No. Change the backdrop, then sample again to update the current color. The backdrop change clears the extracted palette. Keep sampled alpha also requires a new sample and does not change palette compositing.

What happens when I clear an image or saved swatches?

Clear image removes the image and palette and invalidates pending loads while keeping the current color, saved swatches and sampler options. Clear swatches removes only the saved list. Neither erases clipboard content or downloaded files.

Why is Pick from screen unavailable?

The button is shown only if the browser exposes EyeDropper. Browser support, secure context and the user-triggered picker flow matter. Use manual values or a local image if it is absent or fails; physical screen selection was not established by the controlled application checks.

Do palette percentages add up to 100%?

Not always. The denominator is all visible sampled pixels, but the selected largest buckets may omit others. Fully transparent pixels are excluded, partially transparent ones are composited, and fewer colors than requested may exist.

Which local image limits apply?

JPG, PNG and still WebP are supported. A file must be at most 25,000,000 bytes, at most 24,000,000 decoded pixels and no more than 12,000 pixels on either side. Detected animated PNG/WebP and unsupported formats are rejected.

Does loading an image automatically change my color?

No. Loading does not sample a pixel, extract a palette or save a color. Use a sampling action or Extract palette, then select a palette color if you want it as the current color and a saved swatch.

Do saved swatches survive a reload?

No. Up to 24 unique RGB/RGBA serializations are kept in the current page, newest first. Download JSON or CSS before reloading or leaving; this is not persistent project storage.

Are swatch and palette exports interchangeable?

They describe separate collections. Swatch JSON retains r/g/b/a plus HEX, and swatch CSS uses RGB/RGBA. Palette JSON contains HEX and percent; palette CSS/TXT and Copy HEX use the extracted opaque HEX colors.

Is the image sample a print proof or the original file byte color?

No. It is a browser-decoded sRGB canvas pixel, optionally composited on a backdrop. Decoding and color management can affect it. Use a profile-aware imaging and print workflow for those measurements.

Sources and references

Put it into practice.

Related guides