generateColor function
Implementation
Color? generateColor(String type, String text) {
Color? color;
if (type == "text") {
if (text.contains("#")) {
try {
color = Color(int.parse(text.substring(1).padLeft(8, "FF"), radix: 16));
} catch (err) {
color = Colors.white;
print(err);
}
}
} else {
if (text.contains("#")) {
try {
color = Color(int.parse(text.substring(1).padLeft(8, "FF"), radix: 16));
} catch (err) {
color = Colors.blueAccent;
print(err);
}
} else {
color = Colors.blueAccent;
}
}
return color;
}