feat: use forest theme in diagram
This commit is contained in:
@@ -103,11 +103,11 @@ export const updateConfig = (config: string, updateEditor: boolean): void => {
|
||||
});
|
||||
};
|
||||
|
||||
export const toggleDarkTheme = (dark: boolean): void => {
|
||||
export const toggleDarkTheme = (dark: boolean, theme: string): void => {
|
||||
codeStore.update((state) => {
|
||||
const config = JSON.parse(state.mermaid);
|
||||
if (!config.theme || ['dark', 'default'].includes(config.theme)) {
|
||||
config.theme = dark ? 'dark' : 'default';
|
||||
if (!config.theme || ['dark', 'default', 'forest'].includes(config.theme)) {
|
||||
config.theme = dark ? (theme === 'forest' ? 'forest' : 'dark') : 'default';
|
||||
}
|
||||
|
||||
return { ...state, mermaid: JSON.stringify(config, null, 2), updateEditor: true };
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
themeStore.subscribe(({ theme, isDark }) => {
|
||||
if (theme) {
|
||||
document.getElementsByTagName('html')[0].setAttribute('data-theme', theme);
|
||||
toggleDarkTheme(isDark);
|
||||
toggleDarkTheme(isDark, theme);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user