mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-19 15:30:03 +02:00
113 lines
2.2 KiB
JavaScript
113 lines
2.2 KiB
JavaScript
/**
|
|
* Returns the styles given options
|
|
*
|
|
* @param {{
|
|
* fontFamily: string;
|
|
* nodeTextColor: string;
|
|
* textColor: string;
|
|
* titleColor: string;
|
|
* mainBkg: string;
|
|
* nodeBorder: string;
|
|
* arrowheadColor: string;
|
|
* lineColor: string;
|
|
* edgeLabelBackground: string;
|
|
* clusterBkg: string;
|
|
* clusterBorder: string;
|
|
* tertiaryColor: string;
|
|
* border2: string;
|
|
* }} options
|
|
* The options for the styles
|
|
* @returns {string} The resulting styles
|
|
*/
|
|
const getStyles = (options) =>
|
|
`.label {
|
|
font-family: ${options.fontFamily};
|
|
color: ${options.nodeTextColor || options.textColor};
|
|
}
|
|
.cluster-label text {
|
|
fill: ${options.titleColor};
|
|
}
|
|
.cluster-label span {
|
|
color: ${options.titleColor};
|
|
}
|
|
|
|
.label text,span {
|
|
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;
|
|
}
|
|
|
|
.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;
|
|
}
|
|
|
|
.cluster rect {
|
|
fill: ${options.clusterBkg};
|
|
stroke: ${options.clusterBorder};
|
|
stroke-width: 1px;
|
|
}
|
|
|
|
.cluster text {
|
|
fill: ${options.titleColor};
|
|
}
|
|
|
|
.cluster span {
|
|
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;
|
|
}
|
|
`;
|
|
|
|
export default getStyles;
|