mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-28 07:03:17 +08:00
change diagramTheme
and themes
to return string
This commit is contained in:
parent
07f6358a80
commit
f2c40271b2
@ -1,7 +1,7 @@
|
|||||||
import type { FlowChartStyleOptions } from './diagrams/flowchart/styles.js';
|
import type { FlowChartStyleOptions } from './diagrams/flowchart/styles.js';
|
||||||
import { log } from './logger.js';
|
import { log } from './logger.js';
|
||||||
|
|
||||||
const themes: Record<string, any> = {};
|
const themes: Record<string, (options?: any) => string> = {};
|
||||||
|
|
||||||
const getStyles = (
|
const getStyles = (
|
||||||
type: string,
|
type: string,
|
||||||
@ -73,9 +73,12 @@ const getStyles = (
|
|||||||
`;
|
`;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const addStylesForDiagram = (type: string, diagramTheme?: unknown): void => {
|
export const addStylesForDiagram = (
|
||||||
|
type: string,
|
||||||
|
diagramTheme?: (options?: any) => string
|
||||||
|
): void => {
|
||||||
if (diagramTheme !== undefined) {
|
if (diagramTheme !== undefined) {
|
||||||
themes[type] = diagramTheme;
|
themes[type] = (options) => diagramTheme(options);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user