Skip to content

Commit

Permalink
change diagramTheme and themes to return string
Browse files Browse the repository at this point in the history
  • Loading branch information
Yokozuna59 committed Jun 26, 2023
1 parent 07f6358 commit f2c4027
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/mermaid/src/styles.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { FlowChartStyleOptions } from './diagrams/flowchart/styles.js';
import { log } from './logger.js';

const themes: Record<string, any> = {};
const themes: Record<string, (options?: any) => string> = {};

const getStyles = (
type: string,
Expand Down Expand Up @@ -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) {
themes[type] = diagramTheme;
themes[type] = (options) => diagramTheme(options);
}
};

Expand Down

0 comments on commit f2c4027

Please sign in to comment.