2022-02-10 16:06:55 +01:00
|
|
|
import $ from "jquery";
|
|
|
|
|
|
|
|
import {localstorage} from "./localstorage";
|
|
|
|
import {page_params} from "./page_params";
|
|
|
|
|
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-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-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
|
|
|
}
|