Remove system theme.

This commit is contained in:
kovacsv 2021-09-04 20:22:28 +02:00
parent a62bf9cf27
commit 50078b26eb
3 changed files with 4 additions and 21 deletions

View File

@ -1,7 +1,6 @@
OV.Theme = {
Light : 1,
Dark : 2,
System : 3
Dark : 2
};
OV.Settings = class
@ -26,17 +25,4 @@ OV.Settings = class
cookieHandler.SetColorVal ('ov_default_color', this.defaultColor);
cookieHandler.SetStringVal ('ov_theme_id', this.themeId);
}
GetTheme ()
{
if (this.themeId === OV.Theme.System) {
if (window.matchMedia && window.matchMedia ('(prefers-color-scheme: dark)').matches) {
return OV.Theme.Dark;
} else {
return OV.Theme.Light;
}
} else {
return this.themeId;
}
}
};

View File

@ -143,7 +143,6 @@ OV.SettingsSidebarPanel = class extends OV.SidebarPanel
};
result.buttons.push (AddRadioButton (buttonsDiv, OV.Theme.Light, 'Light', onChange));
result.buttons.push (AddRadioButton (buttonsDiv, OV.Theme.Dark, 'Dark', onChange));
result.buttons.push (AddRadioButton (buttonsDiv, OV.Theme.System, 'System', onChange));
Select (result.buttons, defaultValue);
return result;

View File

@ -279,15 +279,13 @@ OV.Website = class
SwitchTheme (newThemeId, resetColors)
{
this.settings.themeId = newThemeId;
let calculatedTheme = this.settings.GetTheme ();
this.themeHandler.SwitchTheme (calculatedTheme);
this.themeHandler.SwitchTheme (this.settings.themeId);
this.settings.SaveToCookies (this.cookieHandler);
if (resetColors) {
if (calculatedTheme === OV.Theme.Light) {
if (this.settings.themeId === OV.Theme.Light) {
this.settings.backgroundColor = new OV.Color (255, 255, 255);
this.settings.defaultColor = new OV.Color (200, 200, 200);
} else if (calculatedTheme === OV.Theme.Dark) {
} else if (this.settings.themeId === OV.Theme.Dark) {
this.settings.backgroundColor = new OV.Color (42, 43, 46);
this.settings.defaultColor = new OV.Color (200, 200, 200);
} else {