| "use strict"; |
|
|
| var base = { |
| defaultFontFamily: "Overpass, sans-serif", |
| primaryColor: "#1b68ff", |
| secondaryColor: "#4f4f4f", |
| successColor: "#3ad29f", |
| warningColor: "#ffc107", |
| infoColor: "#17a2b8", |
| dangerColor: "#dc3545", |
| darkColor: "#343a40", |
| lightColor: "#f2f3f6" |
| }; |
|
|
| var extend = { |
| primaryColorLight: tinycolor(base.primaryColor).lighten(10).toString(), |
| primaryColorLighter: tinycolor(base.primaryColor).lighten(30).toString(), |
| primaryColorDark: tinycolor(base.primaryColor).darken(10).toString(), |
| primaryColorDarker: tinycolor(base.primaryColor).darken(30).toString() |
| }; |
|
|
| var chartColors = [base.primaryColor, base.successColor, "#6f42c1", extend.primaryColorLighter]; |
|
|
| var colors = { |
| bodyColor: "#6c757d", |
| headingColor: "#495057", |
| borderColor: "#e9ecef", |
| backgroundColor: "#f8f9fa", |
| mutedColor: "#adb5bd", |
| chartTheme: "light" |
| }; |
|
|
| var darkColor = { |
| bodyColor: "#adb5bd", |
| headingColor: "#e9ecef", |
| borderColor: "#212529", |
| backgroundColor: "#495057", |
| mutedColor: "#adb5bd", |
| chartTheme: "dark" |
| }; |
|
|
| |
| var curentTheme = localStorage.getItem("theme"); |
| var dark = document.querySelector("#darkTheme"); |
| var light = document.querySelector("#lightTheme"); |
| var switcher = document.querySelector("#modeSwitcher"); |
|
|
| function modeSwitch() { |
| var o = localStorage.getItem("theme"); |
| if (o === "dark") { |
| if (dark) dark.disabled = true; |
| if (light) light.disabled = false; |
| localStorage.setItem("theme", "light"); |
| } else { |
| if (dark) dark.disabled = false; |
| if (light) light.disabled = true; |
| localStorage.setItem("theme", "dark"); |
| } |
| } |
|
|
| if (curentTheme === "dark") { |
| if (dark) dark.disabled = false; |
| if (light) light.disabled = true; |
| colors = darkColor; |
| } else { |
| if (dark) dark.disabled = true; |
| if (light) light.disabled = false; |
| } |
|
|
| if (switcher) { |
| switcher.dataset.mode = curentTheme || "light"; |
| } |