Skip to content

Commit

Permalink
【fix】Group parts of the regex together to make the intended operator …
Browse files Browse the repository at this point in the history
…precedence explicit.
  • Loading branch information
songyumeng committed Feb 20, 2024
1 parent 613a054 commit a3d8581
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/common/color-picker/ColorPicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default class ColorPicker extends Vue {
hex: color
};
} else if (/^rgba.+/.test(color)) {
const rgba = color.replace(/(?:^rgba?)\(|\s+|\)$/g, '').split(',');
const rgba = color.replace(/(?:^rgba?)(?:\(|\s+|\)$)/g, '').split(',');
const hex = `#${((1 << 24) + (parseInt(rgba[0]) << 16) + (parseInt(rgba[1]) << 8) + parseInt(rgba[2]))
.toString(16)
.slice(1)}`;
Expand Down

0 comments on commit a3d8581

Please sign in to comment.