feat: use forest theme in diagram

This commit is contained in:
Yash-Singh1
2022-04-16 18:24:18 -07:00
parent f6b34c7903
commit c18574c605
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -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 };
+1 -1
View File
@@ -31,7 +31,7 @@
themeStore.subscribe(({ theme, isDark }) => {
if (theme) {
document.getElementsByTagName('html')[0].setAttribute('data-theme', theme);
toggleDarkTheme(isDark);
toggleDarkTheme(isDark, theme);
}
});
});