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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

50% Discounts On Projects

Do you have a custom project with a clear requirements, we are currently giving a 50% discount on all projects.

We will work with you to ensure we deliver what you need.

If you have questions or want to chat with us, you can reach us on Skype (henry.tochi)

Languages and technologies we use - Java, Kotlin, Laravel, Vue, React, Flutter, Swift and more.