14 lines
373 B
Dart
14 lines
373 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
class HexColor extends Color {
|
|
static int _getColorFromHex(String hexColor) {
|
|
hexColor = hexColor.toUpperCase().replaceAll("#", "");
|
|
if (hexColor.length == 6) {
|
|
hexColor = "FF" + hexColor;
|
|
}
|
|
return int.parse(hexColor, radix: 16);
|
|
}
|
|
|
|
HexColor(final String hexColor) : super(_getColorFromHex(hexColor));
|
|
}
|