How do I use RGB color in Flutter?
You can also use the hexadecimal representation Color(0XFF212845)
.
Comment from source
/// In other words, if AA is the alpha value in hex, RR the red value in hex,
/// GG the green value in hex, and BB the blue value in hex, a color can be
/// expressed asconst Color(0xAARRGGBB)
.
I am using this code block for a personal project of mine in order to show text with a specific color using Color.fromRGBO
, first parameter is Red
, second is Green
, third is Blue
and last parameter defines the Opacity
.
Text(
"This is a sample text",
textAlign: TextAlign.center,
style: TextStyle(
color: Color.fromRGBO(255, 179, 102, 1)
)
)
Try using
Color.fromRGBO(38, 38, 38, 0.4)
Where r
is for Red
, g
is for Green, b
is for Blue
and o
is for opacity
Example:
Container(
width: double.infinity,
height: double.infinity,
color: Color.fromRGBO(38, 38, 38, 0.4),
child: Center(
child: CircularProgressIndicator(),
))