Enhance theme support: update CSS variables for dark and light themes, improve modal styles, and ensure SVGs use currentColor for theme compatibility.

This commit is contained in:
sha
2025-05-01 13:48:32 +03:00
parent 3dd4e50281
commit 4a2230223c
5 changed files with 143 additions and 11 deletions
+11 -2
View File
@@ -11,8 +11,17 @@
const res = await fetch(path);
let text = await res.text();
if (!color) {
// No user-selected color, render as-is (SVG uses fill="currentColor")
svgHtml = text;
// No user-selected color, add currentColor to ensure theme colors are applied
const parser = new DOMParser();
const doc = parser.parseFromString(text, "image/svg+xml");
const svg = doc.documentElement;
// Set currentColor on SVG element if no fill is specified
if (!svg.hasAttribute("fill")) {
svg.setAttribute("fill", "currentColor");
}
svgHtml = doc.documentElement.outerHTML;
return;
}
// Parse and update color only if user selected