graphColor function

Color graphColor(
  1. Object? v,
  2. Color or
)

#RRGGBB or #AARRGGBB.

Implementation

Color graphColor(Object? v, Color or) {
  if (v is! String) return or;
  final hex = v.replaceFirst('#', '');
  final n = int.tryParse(hex, radix: 16);
  if (n == null) return or;
  return hex.length <= 6 ? Color(0xFF000000 | n) : Color(n);
}