Skip to content

Commit

Permalink
[EGON-104] Default icons can be colored again
Browse files Browse the repository at this point in the history
  • Loading branch information
jannik-wps committed Aug 8, 2024
1 parent 611ce4b commit bda36d3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/app/tools/modeler/bpmn/modeler/domainStoryRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,11 +360,13 @@ export default function DomainStoryRenderer(
}

function applyColorToIcon(pickedColor = DEFAULT_COLOR, iconSvg) {
const match = iconSvg.match(/fill[=:]/);
if (match && match.length > 0) {
const match = iconSvg.match(
/fill=\s*"(?!none).*?"|fill:\s*[#r]\w*[;\s]{1}/,
);
if (match && match.some((it) => it)) {
return iconSvg
.replaceAll(/fill="(?!none).*?"/g, `fill="${pickedColor}"`)
.replaceAll(/fill:\s*#\w*[; ]/g, `fill:${pickedColor}`);
.replaceAll(/fill=\s*"(?!none).*?"/g, `fill="${pickedColor} "`)
.replaceAll(/fill:\s*[#r]\w*[;\s]{1}/g, `fill:${pickedColor};`);
} else {
const index = iconSvg.indexOf("<svg ") + 5;
return (
Expand Down

0 comments on commit bda36d3

Please sign in to comment.