Remove system theme.
This commit is contained in:
parent
a62bf9cf27
commit
50078b26eb
@ -1,7 +1,6 @@
|
|||||||
OV.Theme = {
|
OV.Theme = {
|
||||||
Light : 1,
|
Light : 1,
|
||||||
Dark : 2,
|
Dark : 2
|
||||||
System : 3
|
|
||||||
};
|
};
|
||||||
|
|
||||||
OV.Settings = class
|
OV.Settings = class
|
||||||
@ -26,17 +25,4 @@ OV.Settings = class
|
|||||||
cookieHandler.SetColorVal ('ov_default_color', this.defaultColor);
|
cookieHandler.SetColorVal ('ov_default_color', this.defaultColor);
|
||||||
cookieHandler.SetStringVal ('ov_theme_id', this.themeId);
|
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -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.Light, 'Light', onChange));
|
||||||
result.buttons.push (AddRadioButton (buttonsDiv, OV.Theme.Dark, 'Dark', 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);
|
Select (result.buttons, defaultValue);
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
|||||||
@ -279,15 +279,13 @@ OV.Website = class
|
|||||||
SwitchTheme (newThemeId, resetColors)
|
SwitchTheme (newThemeId, resetColors)
|
||||||
{
|
{
|
||||||
this.settings.themeId = newThemeId;
|
this.settings.themeId = newThemeId;
|
||||||
let calculatedTheme = this.settings.GetTheme ();
|
this.themeHandler.SwitchTheme (this.settings.themeId);
|
||||||
|
|
||||||
this.themeHandler.SwitchTheme (calculatedTheme);
|
|
||||||
this.settings.SaveToCookies (this.cookieHandler);
|
this.settings.SaveToCookies (this.cookieHandler);
|
||||||
if (resetColors) {
|
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.backgroundColor = new OV.Color (255, 255, 255);
|
||||||
this.settings.defaultColor = new OV.Color (200, 200, 200);
|
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.backgroundColor = new OV.Color (42, 43, 46);
|
||||||
this.settings.defaultColor = new OV.Color (200, 200, 200);
|
this.settings.defaultColor = new OV.Color (200, 200, 200);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user