Reading colours from an image
The image is drawn on a canvas and the pixel under your click is read directly, so the value you get is the exact colour stored in the file rather than an approximation.
Hex, RGB and where each is used
A hex code such as #1656d3 is the usual way to write a colour in CSS and design tools; it is the same information as the RGB triplet, just written in base 16. Use hex in stylesheets and design software, and RGB when a tool asks for the three channel values separately.
Tips for accurate sampling
- JPG compression shifts colours slightly near edges. Sample from a flat area rather than on a boundary.
- Screenshots of colour-managed applications may not match the original colour exactly.
- Sample several nearby points if a region looks uneven — gradients rarely have one true colour.