How to use Hexadecimal color codes in Flutter

Normally, in Flutter you can mostly find predefined colors by doing something like:

Colors.red
Colors.pink
Colors.pinkAccent

What about if you want to assign your own color code? That’s easy. Use this format:

Color(0xFFCOLOR_CODE)

Replace COLOR_CODE with the color code you want to use E.g

Color(0xFFFFFFFF) //white
Color(0xFF000000) //black

Add a Comment