hex to Flutter Color

Flutter packs alpha first, so a fully opaque colour starts with 0xFF. Dropping the alpha byte gives a fully transparent colour, which is the classic Flutter colour bug.

Hue
Alpha
100%
Flutter Color
Color(0xFF4287F5)

Paste a hex value — other formats work too.

Need every format at once? Open in the full picker

Worked examples

Common colours converted from hex to Flutter Color, computed with the same engine the picker uses.

ColourhexFlutter ColorCopy
Pure red#ff0000Color(0xFFFF0000)
Pure green#00ff00Color(0xFF00FF00)
Pure blue#0000ffColor(0xFF0000FF)
White#ffffffColor(0xFFFFFFFF)
Mid grey#808080Color(0xFF808080)
Black#000000Color(0xFF000000)
Interface blue#4287f5Color(0xFF4287F5)
Success green#22c55eColor(0xFF22C55E)
Danger red#ef4444Color(0xFFEF4444)
Warning amber#f59e0bColor(0xFFF59E0B)
Editor black#1e1e1eColor(0xFF1E1E1E)
Warm sand#e9c46aColor(0xFFE9C46A)

How the conversion works

Flutter packs alpha first, so a fully opaque colour starts with 0xFF. Dropping the alpha byte gives a fully transparent colour, which is the classic Flutter colour bug.

Both formats are computed from a single canonical representation — CIE XYZ with a D65 white point, held in floating point — rather than by chaining one format into the next. That matters because chained conversions accumulate rounding error, and because it means a colour that cannot be represented in the target format is handled deliberately rather than by accident.

When the source describes a colour outside the target's gamut, chroma is reduced in OKLCh while lightness and hue are held, following the CSS Color 4 gamut mapping algorithm. Clipping each channel independently would be simpler but visibly shifts hue on saturated colours.

Related conversions