thedesk/app/js/ui/theme.js
2018-07-05 10:26:07 +09:00

44 lines
1.3 KiB
JavaScript

//テーマ適用
function themes(theme) {
if (!theme) {
var theme = localStorage.getItem("theme");
if(!theme){
var theme="black";
localStorage.setItem("theme","black");
}
}
if (theme == "black") {
$("html").removeClass("indigotheme");
$("html").removeClass("greentheme");
$("html").removeClass("browntheme");
$("html").addClass("blacktheme");
} else if (theme == "indigo") {
$("html").removeClass("blacktheme");
$("html").removeClass("greentheme");
$("html").removeClass("browntheme");
$("html").addClass("indigotheme");
} else if (theme == "green") {
$("html").removeClass("indigotheme");
$("html").removeClass("greentheme");
$("html").removeClass("browntheme");
$("html").removeClass("blacktheme");
$("html").addClass("greentheme");
} else if (theme == "brown") {
$("html").removeClass("indigotheme");
$("html").removeClass("greentheme");
$("html").removeClass("blacktheme");
$("html").addClass("browntheme");
} else{
$("html").removeClass("indigotheme");
$("html").removeClass("greentheme");
$("html").removeClass("browntheme");
$("html").removeClass("blacktheme");
}
var font = localStorage.getItem("font");
if(font){
$("html").css("font-family",font);
}else{
$("html").css("font-family","");
}
}
themes();