toColor method

Color? toColor()

Implementation

Color? toColor() {
  try {
    if (startsWith('#')) {
      return Color(int.parse(replaceAll('#', '0xff')));
    } else {
      return Color(int.parse(this));
    }
  } catch (e) {
    return null;
  }
}