Skip to content

Commit

Permalink
fix: improve theming regex [skip chromatic] (#1565)
Browse files Browse the repository at this point in the history
closes #785
closes #1564
  • Loading branch information
karlbaumhauer authored Oct 17, 2024
1 parent f772240 commit f40c777
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/theming/src/color-calculation.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ const defaultLuminanceMap = {
};

const extractRGB = str => {
const match = str.match(/,\s*([\d\s]+)\s*\)/);
const parts = str.split(',').filter(part => /\d/.test(part));
const match = parts[1]?.match(/(\d[\d\s]*)\s*\)/);
return match ? match[1] : null;
};

Expand Down

0 comments on commit f40c777

Please sign in to comment.