Guide
Picking exact colors and palettes from an image
By Logappradeep · ServiceNow developer
Matching a color by eye is surprisingly hard. A brand color in a logo, the shade of a sofa in a product photo or a background color in a screenshot all need an exact value before you can use them in CSS, a design tool or a paint store. An image color picker reads the precise value of any pixel you click.
Picking a single color
Load an image and click anywhere on it. The tool reads that pixel and shows its value in several notations: HEX (such as #3A7BD5), used in web design; RGB, the red, green and blue components from 0 to 255; and HSL, hue, saturation and lightness, which is easier to adjust by hand when you want a lighter or more muted variant. Copy any of them with one click. A magnified view helps you land on exactly the right pixel near edges.
Extracting a dominant palette
Besides individual pixels, the tool can summarize an image as a handful of dominant colors. It samples pixels across the image and groups similar colors together, then reports the most representative color of each large group. The result is a small palette that captures the overall feel of a photo, which is a fast way to build a color scheme from a mood board or to find complementary colors for a design based on a hero image.
How it works
The image is drawn onto an HTML canvas, and the Canvas API returns the raw red, green, blue and alpha values for any pixel. The palette is calculated from those values directly in your browser. The image never leaves your device, so you can sample colors from unreleased designs or client artwork without sharing them.
Why picked colors can surprise you
- Anti-aliasing: edges of text and shapes blend into the background, so a pixel on an edge is a mix of both colors. Click well inside the shape.
- Compression artifacts: JPEG compression shifts colors slightly, especially near sharp edges. A flat area in a JPG may contain several close shades. Use a PNG source when you need the exact original value.
- Lighting and shading: in photos, the same object has many shades depending on light. Pick from a mid-tone area, or use the palette to find a representative color.
- Color profiles: images with embedded color profiles may be converted to your display's color space when drawn, so values can differ slightly from what a professional editor reports.
Putting colors to use
Paste HEX values straight into CSS or design tools. Check text and background combinations for sufficient contrast before using them in an interface, since a pleasing palette is not automatically readable. For brand work, confirm the official values with the brand's guidelines, because a color sampled from a compressed image is an approximation.