Skip to content

Commit a606c56

Browse files
committed
chore(xml): add normalizeColorObject
1 parent a675ebf commit a606c56

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/helper/modify-color-helper.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ export default class ModifyColorHelper {
1313
if (!color || !color.type || element?.getElementsByTagName === undefined)
1414
return;
1515

16+
ModifyColorHelper.normalizeColorObject(color);
17+
1618
const solidFills = element.getElementsByTagName('a:solidFill');
1719

1820
if (!solidFills.length) {
@@ -49,4 +51,15 @@ export default class ModifyColorHelper {
4951
element.removeChild(hasNoFill);
5052
}
5153
};
54+
55+
static normalizeColorObject = (color: Color) => {
56+
if (color.value.indexOf('#') === 0) {
57+
color.value = color.value.replace('#', '');
58+
}
59+
if (color.value.toLowerCase().indexOf('rgb(') === 0) {
60+
// TODO: convert RGB to HEX
61+
color.value = 'cccccc';
62+
}
63+
return color;
64+
};
5265
}

0 commit comments

Comments
 (0)