How to use Hexadecimal Color Code in Flutter

1 Min Read

To use hexadecimal value in a flutter, first, call the Color class and pass the hexadecimal color as an argument.

For Example, To use the red color in our app, add the 0xff in front of the red color like this 0xffFF0000.

Color c = const Color(0xFFFF0000);

Also, you can use ARGB and RGBO colors.


Color c = const Color.fromARGB(0xFF, 0x42, 0xA5, 0xF5);
 Color c = const Color.fromARGB(255, 66, 165, 245); 
Color c = const Color.fromRGBO(66, 165, 245, 1.0);

The hexadecimal is 8 digits, if you only specify 6 digits the remaining two digits will be considered as zero which means fully transparent.

Fully Transparent color code,

Color c1 = const Color(0xFFFFFF); 

Also check, how to remove debug banner / debug tag in a flutter

Share this Article
1 Comment