faabul_color_conversion 1.0.0 faabul_color_conversion: ^1.0.0 copied to clipboard
Flutter extensions on String to parse web colors and on Color to produce web color String.
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();
copied to clipboard
To parse a String
to Color
, call parseAsColor()
on the String
object:
final color = '#8D3B72'.parseAsColor();
copied to clipboard
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
copied to clipboard