mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2024-12-21 22:07:48 +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);
|
||||
});
|
||||
}
|
||||
let theme = localStorage.getItem('theme');
|
||||
if (theme === 'light') {
|
||||
this.themeService.setDarkMode(false);
|
||||
} else {
|
||||
this.themeService.setDarkMode(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,5 @@ export class SettingsComponent implements OnInit {
|
||||
|
||||
setDarkMode(value: boolean) {
|
||||
this.themeService.setDarkMode(value);
|
||||
//this value should be saved and stored in local memory
|
||||
}
|
||||
}
|
||||
|
@ -41,12 +41,15 @@ export class ThemeService {
|
||||
|
||||
setDarkMode(value: boolean) {
|
||||
this._darkMode$.next(value);
|
||||
localStorage.removeItem('theme');
|
||||
if (value) {
|
||||
this.savedTheme = 'dark';
|
||||
this.themeChanged.emit(this.savedTheme);
|
||||
localStorage.setItem('theme', 'dark');
|
||||
} else {
|
||||
this.savedTheme = 'light';
|
||||
this.themeChanged.emit(this.savedTheme);
|
||||
localStorage.setItem('theme', 'light');
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user