diff --git a/apps/common/main/lib/controller/Themes.js b/apps/common/main/lib/controller/Themes.js index a76ff2576..665d98558 100644 --- a/apps/common/main/lib/controller/Themes.js +++ b/apps/common/main/lib/controller/Themes.js @@ -345,15 +345,15 @@ define([ document.body.className = document.body.className.replace(/theme-[\w-]+\s?/gi, '').trim(); document.body.classList.add(id, 'theme-type-' + themes_map[id].type); - if ( this.api.asc_setContentDarkMode ) - if ( themes_map[id].type == 'light' ) { - this.api.asc_setContentDarkMode(false); - } else { - this.api.asc_setContentDarkMode(this.isContentThemeDark()); - Common.NotificationCenter.trigger('contenttheme:dark', this.isContentThemeDark()); - } - if ( this.api ) { + if ( this.api.asc_setContentDarkMode ) + if ( themes_map[id].type == 'light' ) { + this.api.asc_setContentDarkMode(false); + } else { + this.api.asc_setContentDarkMode(this.isContentThemeDark()); + Common.NotificationCenter.trigger('contenttheme:dark', this.isContentThemeDark()); + } + var obj = get_current_theme_colors(name_colors); obj.type = themes_map[id].type; obj.name = id; diff --git a/apps/common/main/lib/util/htmlutils.js b/apps/common/main/lib/util/htmlutils.js index 4c4a58761..b7b9b730a 100644 --- a/apps/common/main/lib/util/htmlutils.js +++ b/apps/common/main/lib/util/htmlutils.js @@ -56,13 +56,14 @@ if ( window.desktop && !!window.RendererProcessVariable ) { var theme = window.RendererProcessVariable.theme if ( theme ) { + if ( !theme.id && !!theme.type ) { + if ( theme.type == 'dark' ) theme.id = 'theme-dark'; else + if ( theme.type == 'light' ) theme.id = 'theme-classic-light'; + } + if ( theme.id ) { // params.uitheme = undefined; localStorage.setItem("ui-theme-id", theme.id); - } else - if ( !!theme.type ) { - if ( theme.type == 'dark' ) params.uitheme = 'default-dark'; else - if ( theme.type == 'light' ) params.uitheme = 'default-light'; } } }