2022-02-10 16:06:55 +01:00
|
|
|
import $ from "jquery";
|
|
|
|
|
|
|
|
import {localstorage} from "./localstorage";
|
|
|
|
import {page_params} from "./page_params";
|
2023-04-28 19:51:11 +02:00
|
|
|
import * as settings_config from "./settings_config";
|
|
|
|
import {user_settings} from "./user_settings";
|
2022-02-10 16:06:55 +01:00
|
|
|
|
2023-03-25 23:50:45 +01:00
|
|
|
export function enable(): void {
|
2022-11-25 21:55:06 +01:00
|
|
|
$(":root").removeClass("color-scheme-automatic").addClass("dark-theme");
|
2022-02-10 16:06:55 +01:00
|
|
|
|
|
|
|
if (page_params.is_spectator) {
|
|
|
|
const ls = localstorage();
|
|
|
|
ls.set("spectator-theme-preference", "dark");
|
2023-04-28 19:51:11 +02:00
|
|
|
user_settings.color_scheme = settings_config.color_scheme_values.night.code;
|
2022-02-10 16:06:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-03-25 23:50:45 +01:00
|
|
|
export function disable(): void {
|
2022-11-25 21:55:06 +01:00
|
|
|
$(":root").removeClass("color-scheme-automatic").removeClass("dark-theme");
|
2022-02-10 16:06:55 +01:00
|
|
|
|
|
|
|
if (page_params.is_spectator) {
|
|
|
|
const ls = localstorage();
|
|
|
|
ls.set("spectator-theme-preference", "light");
|
2023-04-28 19:51:11 +02:00
|
|
|
user_settings.color_scheme = settings_config.color_scheme_values.day.code;
|
2022-02-10 16:06:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-03-25 23:50:45 +01:00
|
|
|
export function default_preference_checker(): void {
|
2022-11-25 21:55:06 +01:00
|
|
|
$(":root").removeClass("dark-theme").addClass("color-scheme-automatic");
|
2022-02-10 16:06:55 +01:00
|
|
|
}
|