Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

Commit 801367b

Browse files
fix: default fill color
1 parent b1e8fd8 commit 801367b

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/utils/text.utils.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,13 @@ export const applyStyle = ({section, text, svgWidth}: {section: HTMLElement; tex
2929
section.style.wordSpacing = text.getAttribute('word-spacing') || '';
3030
section.style.writingMode = text.getAttribute('writing-mode') || '';
3131

32-
section.style.color = text.getAttribute('fill') || '';
32+
// We want to avoid a textual color (such as "black") and always get the rgb values
33+
const color: string = text.getAttribute('fill') ? window.getComputedStyle(text)?.fill : '';
34+
section.style.color = color || '';
35+
3336
section.style.opacity = text.getAttribute('fill-opacity') || '';
3437

35-
section.style.webkitTextStrokeColor = text.getAttribute('stroke-width') || '';
38+
section.style.webkitTextStrokeWidth = text.getAttribute('stroke-width') || '';
3639
section.style.webkitTextStrokeColor = text.getAttribute('stroke') || '';
3740
};
3841

0 commit comments

Comments
 (0)