UNPKG

@gk8/mermaid

Version:

Markdown-ish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.

122 lines (108 loc) 2.51 kB
import * as khroma from "khroma"; const fade = (color, opacity) => { const channel = khroma.channel; const r = channel(color, "r"); const g = channel(color, "g"); const b = channel(color, "b"); return khroma.rgba(r, g, b, opacity); }; const getStyles = (options) => `.label { font-family: ${options.fontFamily}; color: ${options.nodeTextColor || options.textColor}; } .cluster-label text { fill: ${options.titleColor}; } .cluster-label span,p { color: ${options.titleColor}; } .label text,span,p { fill: ${options.nodeTextColor || options.textColor}; color: ${options.nodeTextColor || options.textColor}; } .node rect, .node circle, .node ellipse, .node polygon, .node path { fill: ${options.mainBkg}; stroke: ${options.nodeBorder}; stroke-width: 1px; } .flowchart-label text { text-anchor: middle; } // .flowchart-label .text-outer-tspan { // text-anchor: middle; // } // .flowchart-label .text-inner-tspan { // text-anchor: start; // } .node .label { text-align: center; } .node.clickable { cursor: pointer; } .arrowheadPath { fill: ${options.arrowheadColor}; } .edgePath .path { stroke: ${options.lineColor}; stroke-width: 2.0px; } .flowchart-link { stroke: ${options.lineColor}; fill: none; } .edgeLabel { background-color: ${options.edgeLabelBackground}; rect { opacity: 0.5; background-color: ${options.edgeLabelBackground}; fill: ${options.edgeLabelBackground}; } text-align: center; } /* For html labels only */ .labelBkg { background-color: ${fade(options.edgeLabelBackground, 0.5)}; // background-color: } .cluster rect { fill: ${options.clusterBkg}; stroke: ${options.clusterBorder}; stroke-width: 1px; } .cluster text { fill: ${options.titleColor}; } .cluster span,p { color: ${options.titleColor}; } /* .cluster div { color: ${options.titleColor}; } */ div.mermaidTooltip { position: absolute; text-align: center; max-width: 200px; padding: 2px; font-family: ${options.fontFamily}; font-size: 12px; background: ${options.tertiaryColor}; border: 1px solid ${options.border2}; border-radius: 2px; pointer-events: none; z-index: 100; } .flowchartTitleText { text-anchor: middle; font-size: 18px; fill: ${options.textColor}; } `; const flowStyles = getStyles; export { flowStyles as f };