Convet hex to RGB flutter

1,414 views
Skip to first unread message

Mohanraj Archunan

unread,
Jan 23, 2019, 5:22:49 AM1/23/19
to Flutter Dev
i have an HEX code , then how can i convert hex to rgb?

Kelvin Ji

unread,
Jan 23, 2019, 6:03:10 AM1/23/19
to Mohanraj Archunan, Flutter Dev
--

On Wednesday, Jan 23, 2019 at 6:22 PM, Mohanraj Archunan <mohanraj...@gmail.com> wrote:
i have an HEX code , then how can i convert hex to rgb?

--
You received this message because you are subscribed to the Google Groups "Flutter Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Greg Spencer

unread,
Jan 23, 2019, 12:50:55 PM1/23/19
to Mohanraj Archunan, Flutter Dev
You can use Flutter's builtin Color class:

Color myColor = Color(0xff120418);
print ('red: ${myColor.red} green: ${myColor.green} blue: ${myColor.blue}');

That will give you RGB values from 0-255.  You can convert them to 0.0 - 1.0 by just dividing each component by 255.0.

-Greg

On Wed, Jan 23, 2019 at 2:22 AM Mohanraj Archunan <mohanraj...@gmail.com> wrote:
i have an HEX code , then how can i convert hex to rgb?

--
Reply all
Reply to author
Forward
0 new messages