mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2024-12-22 06:17:47 +00:00
Saving theme in local storage
This commit is contained in:
parent
6870f707bf
commit
f9af6e32be
@ -28,6 +28,11 @@ export class AppComponent implements OnInit {
|
|||||||
this.electronService.ipcRenderer.send('settings.changed', settings);
|
this.electronService.ipcRenderer.send('settings.changed', settings);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
let theme = localStorage.getItem('theme');
|
||||||
|
if (theme === 'light') {
|
||||||
|
this.themeService.setDarkMode(false);
|
||||||
|
} else {
|
||||||
this.themeService.setDarkMode(true);
|
this.themeService.setDarkMode(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@ -32,6 +32,5 @@ export class SettingsComponent implements OnInit {
|
|||||||
|
|
||||||
setDarkMode(value: boolean) {
|
setDarkMode(value: boolean) {
|
||||||
this.themeService.setDarkMode(value);
|
this.themeService.setDarkMode(value);
|
||||||
//this value should be saved and stored in local memory
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,12 +41,15 @@ export class ThemeService {
|
|||||||
|
|
||||||
setDarkMode(value: boolean) {
|
setDarkMode(value: boolean) {
|
||||||
this._darkMode$.next(value);
|
this._darkMode$.next(value);
|
||||||
|
localStorage.removeItem('theme');
|
||||||
if (value) {
|
if (value) {
|
||||||
this.savedTheme = 'dark';
|
this.savedTheme = 'dark';
|
||||||
this.themeChanged.emit(this.savedTheme);
|
this.themeChanged.emit(this.savedTheme);
|
||||||
|
localStorage.setItem('theme', 'dark');
|
||||||
} else {
|
} else {
|
||||||
this.savedTheme = 'light';
|
this.savedTheme = 'light';
|
||||||
this.themeChanged.emit(this.savedTheme);
|
this.themeChanged.emit(this.savedTheme);
|
||||||
|
localStorage.setItem('theme', 'light');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user