parseRgbColor function
Parse an RGB color string like "rgb(255,0,128)" into a Flutter Color.
Implementation
Color? parseRgbColor(String themeColor) {
final match = RegExp(
r'rgb\(\s?(\d+),\s?(\d+),\s?(\d+)\s?\)',
).firstMatch(themeColor);
if (match == null) return null;
return Color.fromARGB(
255,
int.parse(match.group(1)!),
int.parse(match.group(2)!),
int.parse(match.group(3)!),
);
}