propertyToColor static method

Color propertyToColor(
  1. String property
)

Implementation

static Color propertyToColor(String property) {
  if (property.startsWith("0x")) {
    property = property.substring(2);
  }

  final buffer = StringBuffer();
  if (property.length == 6 || property.length == 7) buffer.write('ff');
  buffer.write(property.replaceFirst('#', ''));

  return Color(int.parse(buffer.toString(), radix: 16));
}