import {log, querySelector} from "../../utilities/exports.js"; export function runThemedLogoFeature() { if (themedLogo()) { log("Themed Logo: Initialized."); } } const tildesLogo = ` `; function themedLogo(): boolean { const siteHeader = querySelector(".site-header-logo"); if (siteHeader.dataset.trxThemedLogo === "true") { return false; } let themedLogo = tildesLogo; for (const customProperty of tildesLogo.match(/var\(--.+\)/g) ?? []) { let color = window .getComputedStyle(document.body) .getPropertyValue(customProperty.slice("var(".length, -1)); if (color === "") { color = "#f0f"; } themedLogo = themedLogo.replace(customProperty, color); } const encodedSvg = encodeURIComponent(themedLogo); siteHeader.dataset.trxThemedLogo = "true"; siteHeader.style.backgroundImage = `url("data:image/svg+xml,${encodedSvg}")`; return true; }