import { colorMix } from './colorMix'; export interface MermaidColors { fg: string; bg: string; accent?: string; line?: string; muted?: string; surface?: string; border?: string; } /** * Build the CSS variable map that beautiful-mermaid's SVG uses internally. * These mirror the ` blocks result = result.replace(//g, ''); // Remove class attributes result = result.replace(/\s*class="[^"]*"/g, ''); // Resolve all var() references in attribute values result = result.replace( /="(var\(--[^"]*\))"/g, (_, varExpr) => `="${resolveVarReferences(varExpr, vars)}"`, ); // Clean up the root SVG style attribute (remove CSS variable definitions and background) result = result.replace(/style="[^"]*"/, ''); return result; }