Skip to content

Commit 7e3ba57

Browse files
committed
fix dark mode
1 parent e5a5808 commit 7e3ba57

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

frontend/webEditor/src/serialize/export.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,14 @@ export class ExportCommand extends Command {
117117

118118
// add stylesheets
119119
const styleHolder = document.createElement("style");
120-
styleHolder.innerHTML = `${themeCss}\n${elementCss}`;
120+
// extract light mode variables from them
121+
const defaultColorsMatch = /:root ({[^}]*})/.exec(themeCss);
122+
let colors = themeCss;
123+
if (defaultColorsMatch) {
124+
colors = `* ${defaultColorsMatch[1]}`;
125+
}
126+
127+
styleHolder.innerHTML = `${colors}\n${elementCss}`;
121128
dom.appendChild(styleHolder);
122129

123130
// render svg into dom

0 commit comments

Comments
 (0)