mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-24 22:09:21 +00:00
15 lines
413 B
Dart
15 lines
413 B
Dart
// https://stackoverflow.com/a/53905427
|
|
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));
|
|
}
|