[desktop] fixed theme initialization on app launch

This commit is contained in:
Maxim Kadushkin 2021-10-14 20:33:30 +03:00
parent 938e916508
commit 2c5e17fd0c
2 changed files with 13 additions and 12 deletions

View file

@ -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;

View file

@ -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';
}
}
}