Skip to content

Commit

Permalink
Fix regex pattern for parsing color, #601
Browse files Browse the repository at this point in the history
  • Loading branch information
cocopon committed Feb 18, 2024
1 parent 5563102 commit 80829c4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ describe(createColorStringParser.name, () => {
[
'0x123',
'601',
'3200',
'112233',
'foobar',
'#eeffgg',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ function parseHexRgbColor(text: string): IntColor | null {

function parseHexRgbaColorComponents(text: string): ColorComponents4 | null {
const mRgb = text.match(
/^#?([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])$/,
/^#([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])$/,
);
if (mRgb) {
return [
Expand Down

0 comments on commit 80829c4

Please sign in to comment.