Material Color Names
A function to convert a string to a color, including material Colors constants
and hexadecimal values. Does not do the reverse operation, and is pretty fast.
Supports inputs like:
"green"for simple material colors (Colors.green)."redAccent.100"for color shades (Colors.redAccent.shade100)."0xff15d6e1"for hexadecimal colors with an alpha channel (Color(0xff15d6e1))."#34A"for short hexadecimal colors (Color(0xFF3344AA)).
Usage
import 'package:material_color_names/material_color_names.dart';
void main() {
print(colorFromString('#feac'));
print(colorFromString('lightBlue.900'));
}
The function knows every color from the Colors class.