We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4f57ef2 commit 7f0373aCopy full SHA for 7f0373a
lib/src/api/models/color_rgba.dart
@@ -112,12 +112,12 @@ class ColorRGBA with EquatableMixin, SerializableMixin {
112
}
113
114
/// Converts this [ColorRGBA] to [ColorRGB] by removing the alpha channel.
115
- String toHex() {
+ String toHex({bool opaque = false, bool includeHash = true}) {
116
final r = (this.r * 255).toInt().toRadixString(16).padLeft(2, '0');
117
final g = (this.g * 255).toInt().toRadixString(16).padLeft(2, '0');
118
final b = (this.b * 255).toInt().toRadixString(16).padLeft(2, '0');
119
final a = (this.a * 255).toInt().toRadixString(16).padLeft(2, '0');
120
- return '#$a$r$g$b'.toUpperCase();
+ return '${includeHash ? '#' : ''}${opaque ? '' : a}$r$g$b'.toUpperCase();
121
122
123
@override
0 commit comments