Skip to content

Commit acb7df5

Browse files
committed
fix: padding hex color value
1 parent 04bb786 commit acb7df5

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

lib/src/utils.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ class ColorUtils {
5656
final sg = bbcodeColor.g;
5757
final sb = bbcodeColor.b;
5858
final sa = bbcodeColor.a;
59-
final r = ((sr * sa + 0 * (1 - sa)) * 255).toInt().toRadixString(16);
60-
final g = ((sg * sa + 0 * (1 - sa)) * 255).toInt().toRadixString(16);
61-
final b = ((sb * sa + 0 * (1 - sa)) * 255).toInt().toRadixString(16);
59+
final r = ((sr * sa + 0 * (1 - sa)) * 255).toInt().toRadixString(16).padLeft(2, '0');
60+
final g = ((sg * sa + 0 * (1 - sa)) * 255).toInt().toRadixString(16).padLeft(2, '0');
61+
final b = ((sb * sa + 0 * (1 - sa)) * 255).toInt().toRadixString(16).padLeft(2, '0');
6262
return '#$r$g$b';
6363
} else {
6464
return 'rgb(${(bbcodeColor.r * 255).toInt()}, '

0 commit comments

Comments
 (0)