From a761a0103805f107fbf76fddf57309ae6c0dfcd9 Mon Sep 17 00:00:00 2001 From: Kendell R Date: Sun, 26 May 2024 14:08:37 -0700 Subject: [PATCH] fix(convertColors): accept commaless rgb (#2015) --- plugins/convertColors.js | 2 +- test/plugins/convertColors.01.svg.txt | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/convertColors.js b/plugins/convertColors.js index 48858f2b7..aa9c8fa77 100644 --- a/plugins/convertColors.js +++ b/plugins/convertColors.js @@ -6,7 +6,7 @@ export const description = 'converts colors: rgb() to #rrggbb and #rrggbb to #rgb'; const rNumber = '([+-]?(?:\\d*\\.\\d+|\\d+\\.?)%?)'; -const rComma = '\\s*,\\s*'; +const rComma = '(?:\\s*,\\s*|\\s+)'; const regRGB = new RegExp( '^rgb\\(\\s*' + rNumber + rComma + rNumber + rComma + rNumber + '\\s*\\)$', ); diff --git a/test/plugins/convertColors.01.svg.txt b/test/plugins/convertColors.01.svg.txt index 90aa8c0da..3f4c72a5b 100644 --- a/test/plugins/convertColors.01.svg.txt +++ b/test/plugins/convertColors.01.svg.txt @@ -1,6 +1,7 @@ + @@ -12,6 +13,7 @@ +