tangled
alpha
login
or
join now
vielle.dev
/
wol
1
fork
atom
[WIP] A simple wake-on-lan service
1
fork
atom
overview
issues
pulls
pipelines
use theme in webapp
vielle.dev
5 days ago
4b3aee7c
a610e804
verified
This commit was signed with the committer's
known signature
.
vielle.dev
SSH Key Fingerprint:
SHA256:EoUuRRBFQKUfYh74C568g83i9g4fVi5OTtOENMSfa+0=
+55
-3
3 changed files
expand all
collapse all
unified
split
web
src
App.svelte
lib
ThemeProvider.svelte
api.ts
+3
-3
web/src/App.svelte
···
1
1
<script lang="ts">
2
2
-
import Api from "./lib/api";
2
2
+
import { config } from "./lib/api";
3
3
import Power from "./lib/Power.svelte";
4
4
-
5
5
-
const config = await Api.config();
4
4
+
import ThemeProvider from "./lib/ThemeProvider.svelte";
6
5
7
6
const targets = [
8
7
...Object.entries(config.targets)
···
19
18
console.log(config);
20
19
</script>
21
20
21
21
+
<ThemeProvider />
22
22
<h1>Wake on Lan</h1>
23
23
{#each targets as [name, { mac, ip, url }]}
24
24
<Power {name} {mac} {ip} {url} />
+50
web/src/lib/ThemeProvider.svelte
···
1
1
+
<script lang="ts">
2
2
+
import { config } from "./api";
3
3
+
4
4
+
const rgb = ([r, g, b]: [number, number, number]) => `rgb(${r}, ${g}, ${b})`;
5
5
+
6
6
+
const custom = {
7
7
+
"--theme-background": rgb(config.theme.background),
8
8
+
"--theme-foreground": rgb(config.theme.foreground),
9
9
+
"--theme-text": rgb(config.theme.text),
10
10
+
"--theme-text-secondary": rgb(config.theme.text_secondary),
11
11
+
"--theme-accent-success": rgb(config.theme.accent_success),
12
12
+
"--theme-accent-fail": rgb(config.theme.accent_fail),
13
13
+
"--theme-link": rgb(config.theme.link),
14
14
+
"--theme-link-visited": rgb(config.theme.link_visited),
15
15
+
"--theme-highlight": rgb(config.theme.highlight),
16
16
+
"--theme-highlight-opacity": `${config.theme.highlight_opacity / 100}`,
17
17
+
};
18
18
+
19
19
+
for (const [k, v] of Object.entries(custom))
20
20
+
document.body.style.setProperty(k, v);
21
21
+
</script>
22
22
+
23
23
+
<style>
24
24
+
:global {
25
25
+
@layer reset {
26
26
+
* {
27
27
+
margin: 0;
28
28
+
padding: 0;
29
29
+
box-sizing: border-box;
30
30
+
font-family: inherit;
31
31
+
}
32
32
+
}
33
33
+
34
34
+
a {
35
35
+
color: var(--theme-link);
36
36
+
37
37
+
&:visited {
38
38
+
color: var(--theme-link-visited);
39
39
+
}
40
40
+
41
41
+
&:hover {
42
42
+
text-decoration-style: dotted;
43
43
+
}
44
44
+
45
45
+
&:active {
46
46
+
text-decoration: none;
47
47
+
}
48
48
+
}
49
49
+
}
50
50
+
</style>
+2
web/src/lib/api.ts
···
101
101
}),
102
102
} as const;
103
103
104
104
+
export const config = await Api.config();
105
105
+
104
106
export default Api;