hrenpack-theme-style 3.8.6 → 3.8.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dark-theme.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- declare function get_hts_url(): string;
2
- declare var useIcon: boolean;
3
- declare const tt_button: HTMLButtonElement;
4
- declare const stylesheet: HTMLLinkElement;
5
- declare const cookieTheme: string | null, lsTheme: string | null;
6
- declare const theme_url_prefix: string;
7
- declare const theme_light: string, theme_dark: string;
8
- declare let currentTheme: string;
9
- declare let lightIcon: string;
10
- declare let darkIcon: string;
11
- declare function setButtonIcon(first?: boolean): void;
12
- declare function toggleTheme(): void;
1
+ declare function get_hts_url(): string;
2
+ declare var useIcon: boolean;
3
+ declare const tt_button: HTMLButtonElement;
4
+ declare const stylesheet: HTMLLinkElement;
5
+ declare const cookieTheme: string | null, lsTheme: string | null;
6
+ declare const theme_url_prefix: string;
7
+ declare const theme_light: string, theme_dark: string;
8
+ declare let currentTheme: string;
9
+ declare let lightIcon: string;
10
+ declare let darkIcon: string;
11
+ declare function setButtonIcon(first?: boolean): void;
12
+ declare function toggleTheme(): void;
13
13
  //# sourceMappingURL=dark-theme.d.ts.map
package/dark-theme.js CHANGED
@@ -1,60 +1,60 @@
1
- "use strict";
2
- function get_hts_url() {
3
- return document.currentScript.src
4
- .split('/').slice(0, -1).join('/') + '/';
5
- }
6
- var useIcon = false;
7
- const tt_button = document.querySelector('#hrenpack-toggle-theme');
8
- const stylesheet = document.querySelector('#hrenpack-theme-stylesheet');
9
- const cookieTheme = getCookie?.('theme'), lsTheme = localStorage.getItem('theme');
10
- const theme_url_prefix = get_hts_url();
11
- const theme_light = theme_url_prefix + 'style_light.css', theme_dark = theme_url_prefix + 'style_dark.css';
12
- let currentTheme;
13
- let lightIcon = "https://raw.githubusercontent.com/MagIlyasDOMA/hrenpack-theme-style/refs/heads/data/toggle-theme/light.svg";
14
- let darkIcon = "https://raw.githubusercontent.com/MagIlyasDOMA/hrenpack-theme-style/refs/heads/data/toggle-theme/dark.svg";
15
- if (cookieTheme)
16
- currentTheme = cookieTheme;
17
- else if (lsTheme)
18
- currentTheme = lsTheme;
19
- else
20
- currentTheme = getSystemTheme() || 'light';
21
- if (stylesheet) {
22
- stylesheet.setAttribute('href', currentTheme === 'light' ? theme_light : theme_dark);
23
- }
24
- function setButtonIcon(first = false) {
25
- if (useIcon) {
26
- let icon = tt_button.querySelector('img');
27
- if (!icon) {
28
- icon = document.createElement('img');
29
- tt_button.innerHTML = '';
30
- tt_button.appendChild(icon);
31
- }
32
- if (!first)
33
- icon.src = currentTheme === 'light' ? darkIcon : lightIcon;
34
- else
35
- icon.src = currentTheme === 'light' ? lightIcon : darkIcon;
36
- }
37
- }
38
- function toggleTheme() {
39
- const newTheme = currentTheme === 'light' ? 'dark' : 'light';
40
- localStorage.setItem('theme', newTheme);
41
- if (stylesheet) {
42
- stylesheet.addEventListener('load', () => {
43
- currentTheme = newTheme;
44
- btn_hren_update();
45
- setCookie?.('theme', newTheme);
46
- }, { once: true });
47
- stylesheet.setAttribute('href', newTheme === 'light' ? theme_light : theme_dark);
48
- }
49
- else {
50
- currentTheme = newTheme;
51
- btn_hren_update();
52
- setCookie?.('theme', newTheme);
53
- }
54
- setButtonIcon();
55
- }
56
- if (tt_button) {
57
- tt_button.addEventListener('click', toggleTheme);
58
- }
59
- document.addEventListener('DOMContentLoaded', () => { setButtonIcon(true); });
1
+ "use strict";
2
+ function get_hts_url() {
3
+ return document.currentScript.src
4
+ .split('/').slice(0, -1).join('/') + '/';
5
+ }
6
+ var useIcon = false;
7
+ const tt_button = document.querySelector('#hrenpack-toggle-theme');
8
+ const stylesheet = document.querySelector('#hrenpack-theme-stylesheet');
9
+ const cookieTheme = getCookie?.('theme'), lsTheme = localStorage.getItem('theme');
10
+ const theme_url_prefix = get_hts_url();
11
+ const theme_light = theme_url_prefix + 'style_light.css', theme_dark = theme_url_prefix + 'style_dark.css';
12
+ let currentTheme;
13
+ let lightIcon = "https://raw.githubusercontent.com/MagIlyasDOMA/hrenpack-theme-style/refs/heads/data/toggle-theme/light.svg";
14
+ let darkIcon = "https://raw.githubusercontent.com/MagIlyasDOMA/hrenpack-theme-style/refs/heads/data/toggle-theme/dark.svg";
15
+ if (cookieTheme)
16
+ currentTheme = cookieTheme;
17
+ else if (lsTheme)
18
+ currentTheme = lsTheme;
19
+ else
20
+ currentTheme = getSystemTheme() || 'light';
21
+ if (stylesheet) {
22
+ stylesheet.setAttribute('href', currentTheme === 'light' ? theme_light : theme_dark);
23
+ }
24
+ function setButtonIcon(first = false) {
25
+ if (useIcon) {
26
+ let icon = tt_button.querySelector('img');
27
+ if (!icon) {
28
+ icon = document.createElement('img');
29
+ tt_button.innerHTML = '';
30
+ tt_button.appendChild(icon);
31
+ }
32
+ if (!first)
33
+ icon.src = currentTheme === 'light' ? darkIcon : lightIcon;
34
+ else
35
+ icon.src = currentTheme === 'light' ? lightIcon : darkIcon;
36
+ }
37
+ }
38
+ function toggleTheme() {
39
+ const newTheme = currentTheme === 'light' ? 'dark' : 'light';
40
+ localStorage.setItem('theme', newTheme);
41
+ if (stylesheet) {
42
+ stylesheet.addEventListener('load', () => {
43
+ currentTheme = newTheme;
44
+ btn_hren_update();
45
+ setCookie?.('theme', newTheme);
46
+ }, { once: true });
47
+ stylesheet.setAttribute('href', newTheme === 'light' ? theme_light : theme_dark);
48
+ }
49
+ else {
50
+ currentTheme = newTheme;
51
+ btn_hren_update();
52
+ setCookie?.('theme', newTheme);
53
+ }
54
+ setButtonIcon();
55
+ }
56
+ if (tt_button) {
57
+ tt_button.addEventListener('click', toggleTheme);
58
+ }
59
+ document.addEventListener('DOMContentLoaded', () => { setButtonIcon(true); });
60
60
  //# sourceMappingURL=dark-theme.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hrenpack-theme-style",
3
- "version": "3.8.6",
3
+ "version": "3.8.7",
4
4
  "scripts": {
5
5
  "build": "tsc"
6
6
  },
package/style.css CHANGED
@@ -143,7 +143,7 @@ table {
143
143
  padding: 10px;
144
144
  background: linear-gradient(45deg, var(--hrenpack-fcu-grad), var(--hrenpack-background), var(--hrenpack-fcu-grad));
145
145
  color: var(--hrenpack-foreground);
146
- border: #AA22FF solid 2px;
146
+ border: var(--hrenpack-a-hover-color) solid 2px;
147
147
  border-radius: 10px;
148
148
 
149
149
  input, select, textarea {