You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
fluffychat/lib/utils/color_value.dart

15 lines
309 B
Dart

import 'package:flutter/widgets.dart';
extension ColorValue on Color {
int get hexValue {
return _floatToInt8(a) << 24 |
_floatToInt8(r) << 16 |
_floatToInt8(g) << 8 |
_floatToInt8(b) << 0;
}
static int _floatToInt8(double x) {
return (x * 255.0).round() & 0xff;
}
}