– Flutter provide Color Constructor, you can pass a hex value to it.

const color = const Color(0xffb74093);

– You can also set the color opacity using hex code, below i mentioned the list.

Example: Color(0xffb74093), Color(0xf2b74093), Color(0xe6b74093)

  • 100% – FF 
  • 95% – F2 
  • 90% –  E6 
  • 85% – D9 
  • 80% – CC 
  • 75% – BF 
  • 70% – B3 
  • 65% – A6 
  • 60% – 99 
  • 55% – 8C 
  • 50% – 80 
  • 45% – 73 
  • 40% – 66 
  • 35% – 59 
  • 30% – 4D 
  • 25% – 40 
  • 20% – 33 
  • 15% – 26 
  • 10% – 1A 
  • 5% – 0D
  • 0% – 00

– Hex Code is case-insensitive, means 0xFFB74093 is same as 0xffb74093.

– Here is the code with output.

Custom Color Widget.

Now we use this widget by passing a hex value.

code-2

Output:

ouput

Support On Demand!

Flutter

Related Q&A