SVG's support CSS variables.
Instead of hard coding values in the whole file:
<path fill="#123456" .... >You can declare a variable named --color-main and resuse it.
--color-fg: orange;
<path fill="var(--color-main)" ... >
Thats one way to limit the amount of strings you need to append, in dax.
People either use a hundred string plus double quotes in there measure, which turns into a mess.
Or sometimes you'll see SUBSTITUTE( baseHtml, "green", "#fe99aa" ) The problem is that it often matches values you don't want.
How can you fix that? If you could pick a delimeter that's never used, that becomes easy.
I chose ␞
It's a record-separator-symbol https://www.compart.com/en/unicode/U+241E . It's safe to print, and human visible. ( It is not the invisible control character. it's the safe symbol to visualize that character )
Based on the measure's filter context.
I edited my original svg from:
path {
stroke-width: 4;
}
to
path {
stroke-width: ␞StrokeWidth␞;
}
Now I can replace it without fear
var render = SUBSTITUTE( rawSvg, "␞StrokeWidth␞", StrokeWidth )