Welcome to mirror list, hosted at ThFree Co, Russian Federation.

sada_main.js « src « static - github.com/darshanbaral/sada.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 28a00be76a2f82820c099de8d5907f91106b1b52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
$(document).ready(function() {
  const darkTheme = {
    mainBackground: "bg-dark",
    altBackground: "bg-secondary",
    altText: "text-light",
    mainText: "text-white",
    linkText: "text-warning",
    skillBackground: "bg-success"
  };

  const lightTheme = {
    mainBackground: "bg-white",
    altBackground: "bg-light",
    altText: "text-secondary",
    mainText: "text-dark",
    linkText: "text-success",
    skillBackground: "bg-danger"
  };

  let isDark = true;

  $("#toggleTheme").click(function() {
    if (isDark) {
      for (let key in darkTheme) {
        $(`.${darkTheme[key]}`).addClass(lightTheme[key]);
        $(`.${darkTheme[key]}`).removeClass(darkTheme[key]);
      }
      isDark = !isDark;
    } else {
      for (let key in darkTheme) {
        $(`.${lightTheme[key]}`).addClass(darkTheme[key]);
        $(`.${lightTheme[key]}`).removeClass(lightTheme[key]);
      }
      isDark = !isDark;
    }
  });
});