How to use Hexadecimal Color Code in Flutter

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);
Code language: JavaScript (javascript)

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);
Code language: JavaScript (javascript)

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);
Code language: JavaScript (javascript)

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