isHexColor static method
验证十六进制颜色值 (#RGB, #RGBA, #RRGGBB, #RRGGBBAA)
Implementation
static bool isHexColor(String? color) {
const pattern =
r'^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$';
return hasMatch(color, pattern);
}