isRgbColor function
Returns true if str is a CSS rgb() or rgba() color with every
channel in 0–255.
Implementation
bool isRgbColor(String str) {
final match = rgbColorReg.firstMatch(str.trim());
if (match == null) return false;
for (var group = 1; group <= 3; group++) {
final channel = int.parse(match.group(group)!);
if (channel > 255) return false;
}
return true;
}