Skip to content

Commit

Permalink
fix(convertColors): accept commaless rgb (#2015)
Browse files Browse the repository at this point in the history
  • Loading branch information
KTibow committed May 26, 2024
1 parent 4daaa42 commit a761a01
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion plugins/convertColors.js
Original file line number Diff line number Diff line change
Expand Up @@ -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*\\)$',
);
Expand Down
2 changes: 2 additions & 0 deletions test/plugins/convertColors.01.svg.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<svg xmlns="http://www.w3.org/2000/svg">
<g color="black"/>
<g color="BLACK"/>
<path fill="rgb(64 64 64)"/>
<path fill="rgb(64, 64, 64)"/>
<path fill="rgb(86.27451%,86.666667%,87.058824%)"/>
<path fill="rgb(-255,100,500)"/>
Expand All @@ -12,6 +13,7 @@
<g color="#000"/>
<g color="#000"/>
<path fill="#404040"/>
<path fill="#404040"/>
<path fill="#dcddde"/>
<path fill="#0064ff"/>
</svg>

0 comments on commit a761a01

Please sign in to comment.