1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-25 06:19:22 +00:00
comunicmobile/lib/utils/color_utils.dart

15 lines
331 B
Dart
Raw Normal View History

2021-03-13 09:09:17 +00:00
import 'dart:ui';
/// Color utilities
///
/// @author Pierre Hubert
String colorToHex(Color? color) {
2021-03-13 09:09:17 +00:00
if (color == null) return "";
2021-03-13 09:32:11 +00:00
return (color.red.toRadixString(16).padLeft(2, '0') +
color.green.toRadixString(16).padLeft(2, '0') +
color.blue.toRadixString(16).padLeft(2, '0'))
.toUpperCase();
2021-03-13 09:09:17 +00:00
}