@dicebear/core 9.4.0 → 9.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/utils/svg.js +3 -3
- package/package.json +1 -1
package/lib/utils/svg.js
CHANGED
|
@@ -15,7 +15,7 @@ export function getViewBox(result) {
|
|
|
15
15
|
}
|
|
16
16
|
export function addBackground(result, primaryColor, secondaryColor, type, rotation) {
|
|
17
17
|
let { width, height, x, y } = getViewBox(result);
|
|
18
|
-
const solidBackground = `<rect fill="${primaryColor}" width="${width}" height="${height}" x="${x}" y="${y}" />`;
|
|
18
|
+
const solidBackground = `<rect fill="${escape.xml(primaryColor)}" width="${width}" height="${height}" x="${x}" y="${y}" />`;
|
|
19
19
|
switch (type) {
|
|
20
20
|
case 'solid':
|
|
21
21
|
return solidBackground + result.body;
|
|
@@ -23,8 +23,8 @@ export function addBackground(result, primaryColor, secondaryColor, type, rotati
|
|
|
23
23
|
return (`<rect fill="url(#backgroundLinear)" width="${width}" height="${height}" x="${x}" y="${y}" />` +
|
|
24
24
|
`<defs>` +
|
|
25
25
|
`<linearGradient id="backgroundLinear" gradientTransform="rotate(${rotation} 0.5 0.5)">` +
|
|
26
|
-
`<stop stop-color="${primaryColor}"/>` +
|
|
27
|
-
`<stop offset="1" stop-color="${secondaryColor}"/>` +
|
|
26
|
+
`<stop stop-color="${escape.xml(primaryColor)}"/>` +
|
|
27
|
+
`<stop offset="1" stop-color="${escape.xml(secondaryColor)}"/>` +
|
|
28
28
|
`</linearGradient>` +
|
|
29
29
|
`</defs>` +
|
|
30
30
|
result.body);
|