faabul_color_conversion
faabul_color_conversion is used by Faabul Color Picker package and developed by Faabul Live Quizzes.
Getting Started
To convert Color
to String
, call asWebColor()
on the Color
object:
final color = Colors.teal;
final hex = color.asWebColor();
To parse a String
to Color
, call parseAsColor()
on the String
object:
final color = '#8D3B72'.parseAsColor();
String can be either RRGGBB or AARRGGBB format, case insensitive.
parseAsColor()
method will throw FormatException
if the string is not a valid color.
For convenience, you can use tryParseAsColor()
method instead, which will return null
if the string is not a valid color:
final color = '#INVALID'.tryParseAsColor(); // null
Libraries
- faabul_color_conversion
- This package is a simple extension to the Color and String classes that add following methods: