monra commited on
Commit
35716ec
1 Parent(s): ef571a5

Improves and fixes some light mode issues

Browse files
client/css/global-light.css DELETED
@@ -1,53 +0,0 @@
1
- @import url("https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap");
2
-
3
- :root {
4
- --font-1: "Inter", sans-serif;
5
- --section-gap: 20px;
6
- --border-radius-1: 12px;
7
-
8
- --colour-1: #ededed;
9
- --colour-2: #000000;
10
- --colour-3: #000000;
11
- --colour-4: #000000;
12
- --colour-5: #f4f4f4;
13
- --colour-6: #d3d3d3;
14
-
15
- --accent: #303030;
16
- --blur-bg: #f4f4f4;
17
- --blur-border: #e8e8e8;
18
- --user-input: #000000;
19
- --conversations: #555555;
20
- }
21
-
22
- * {
23
- margin: 0;
24
- padding: 0;
25
- box-sizing: border-box;
26
- position: relative;
27
- font-family: var(--font-1);
28
- }
29
-
30
- html,
31
- body {
32
- background: var(--colour-1);
33
- color: var(--colour-3);
34
- }
35
-
36
- ol,
37
- ul {
38
- padding-left: 40px;
39
- }
40
-
41
- .shown {
42
- display: flex !important;
43
- }
44
-
45
- a:-webkit-any-link {
46
- color: var(--accent);
47
- }
48
-
49
- @media screen and (max-height: 720px) {
50
- :root {
51
- --section-gap: 40px;
52
- }
53
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
client/css/global.css CHANGED
@@ -1,10 +1,31 @@
1
  @import url("https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap");
2
-
3
- :root {
4
  --font-1: "Inter", sans-serif;
5
  --section-gap: 24px;
6
  --border-radius-1: 8px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
 
8
  --colour-1: #181818;
9
  --colour-2: #ccc;
10
  --colour-3: #dadada;
@@ -19,14 +40,6 @@
19
  --conversations: #555555;
20
  }
21
 
22
- * {
23
- margin: 0;
24
- padding: 0;
25
- box-sizing: border-box;
26
- position: relative;
27
- font-family: var(--font-1);
28
- }
29
-
30
  html,
31
  body {
32
  background: var(--colour-1);
 
1
  @import url("https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap");
2
+ * {
 
3
  --font-1: "Inter", sans-serif;
4
  --section-gap: 24px;
5
  --border-radius-1: 8px;
6
+ margin: 0;
7
+ padding: 0;
8
+ box-sizing: border-box;
9
+ position: relative;
10
+ font-family: var(--font-1);
11
+ }
12
+
13
+ .theme-light {
14
+ --colour-1: #ededed;
15
+ --colour-2: #000000;
16
+ --colour-3: #000000;
17
+ --colour-4: #000000;
18
+ --colour-5: #f4f4f4;
19
+ --colour-6: #d3d3d3;
20
+
21
+ --accent: #303030;
22
+ --blur-bg: #f4f4f4;
23
+ --blur-border: #e8e8e8;
24
+ --user-input: #000000;
25
+ --conversations: #555555;
26
+ }
27
 
28
+ .theme-dark {
29
  --colour-1: #181818;
30
  --colour-2: #ccc;
31
  --colour-3: #dadada;
 
40
  --conversations: #555555;
41
  }
42
 
 
 
 
 
 
 
 
 
43
  html,
44
  body {
45
  background: var(--colour-1);
client/html/index.html CHANGED
@@ -92,8 +92,8 @@
92
  <span>Web Access</span>
93
  </div>
94
  <div class="field checkbox">
95
- <input type="checkbox" id="lightmode" />
96
- <label for="lightmode"></label>
97
  <span>Light Mode</span>
98
  </div>
99
  </div>
@@ -113,20 +113,6 @@
113
  <script src="https://cdn.jsdelivr.net/npm/markdown-it@latest/dist/markdown-it.min.js"></script>
114
  <script src="/assets/js/highlight.min.js"></script>
115
  <script src="/assets/js/highlightjs-copy.min.js"></script>
116
- <script>
117
- var lightmode = document.getElementById("lightmode");
118
- var styleLink = document.createElement("link");
119
- styleLink.rel = "stylesheet";
120
- styleLink.href = "/assets/css/global.css";
121
- document.head.appendChild(styleLink);
122
-
123
- lightmode.addEventListener("change", function() {
124
- if (lightmode.checked) {
125
- styleLink.href = "/assets/css/global-light.css";
126
- } else {
127
- styleLink.href = "/assets/css/global.css";
128
- }
129
- });
130
- </script>
131
  </body>
132
  </html>
 
92
  <span>Web Access</span>
93
  </div>
94
  <div class="field checkbox">
95
+ <input type="checkbox" id="theme-toggler" />
96
+ <label for="theme-toggler"></label>
97
  <span>Light Mode</span>
98
  </div>
99
  </div>
 
113
  <script src="https://cdn.jsdelivr.net/npm/markdown-it@latest/dist/markdown-it.min.js"></script>
114
  <script src="/assets/js/highlight.min.js"></script>
115
  <script src="/assets/js/highlightjs-copy.min.js"></script>
116
+ <script src="/assets/js/theme-toggler.js"></script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  </body>
118
  </html>
client/js/theme-toggler.js ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var switch_theme_toggler = document.getElementById("theme-toggler");
2
+
3
+ switch_theme_toggler.addEventListener("change", toggleTheme);
4
+
5
+ function setTheme(themeName) {
6
+ localStorage.setItem("theme", themeName);
7
+ document.documentElement.className = themeName;
8
+ }
9
+
10
+ function toggleTheme() {
11
+ var currentTheme = localStorage.getItem("theme");
12
+ var newTheme = currentTheme === "theme-dark" ? "theme-light" : "theme-dark";
13
+
14
+ setTheme(newTheme);
15
+ switch_theme_toggler.checked = newTheme === "theme-light";
16
+ }
17
+
18
+ (function () {
19
+ var currentTheme = localStorage.getItem("theme") || "theme-dark";
20
+ setTheme(currentTheme);
21
+ switch_theme_toggler.checked = currentTheme === "theme-light";
22
+ })();