diff --git a/packages/parchment/lib/src/codecs/html.dart b/packages/parchment/lib/src/codecs/html.dart index 7320c762..a125f904 100644 --- a/packages/parchment/lib/src/codecs/html.dart +++ b/packages/parchment/lib/src/codecs/html.dart @@ -539,13 +539,13 @@ class _HtmlInlineTag extends _HtmlTag { final argb = toRGBA(value); return '<${_inlineAttributesParchmentToHtml[key]} ' 'style="color: ' - 'rgba(${argb[1]},${argb[2]},${argb[3]},${argb[0] / 255})">'; + 'rgba(${argb.R},${argb.G},${argb.B},${argb.A / 255})">'; } if (key == ParchmentAttribute.backgroundColor.key) { final argb = toRGBA(value); return '<${_inlineAttributesParchmentToHtml[key]} ' 'style="background-color: ' - 'rgba(${argb[1]},${argb[2]},${argb[3]},${argb[0] / 255})">'; + 'rgba(${argb.R},${argb.G},${argb.B},${argb.A / 255})">'; } return '<${_inlineAttributesParchmentToHtml[key]}>'; } diff --git a/packages/parchment/lib/src/codecs/html_utils.dart b/packages/parchment/lib/src/codecs/html_utils.dart index 5a3380b3..4120b3e2 100644 --- a/packages/parchment/lib/src/codecs/html_utils.dart +++ b/packages/parchment/lib/src/codecs/html_utils.dart @@ -1,11 +1,10 @@ -// TODO: Use tuple once Parchment is ported to Dart 3 -List toRGBA(int colorValue) { - return [ - (0xff000000 & colorValue) >> 24, - (0x00ff0000 & colorValue) >> 16, - (0x0000ff00 & colorValue) >> 8, - (0x000000ff & colorValue) >> 0 - ]; +({int R, int G, int B, int A}) toRGBA(int colorValue) { + return ( + A: (0xff000000 & colorValue) >> 24, + R: (0x00ff0000 & colorValue) >> 16, + G: (0x0000ff00 & colorValue) >> 8, + B: (0x000000ff & colorValue) >> 0 + ); } int colorValueFromCSS(String cssColor) {