|
2 | 2 | <html> |
3 | 3 | <head> |
4 | 4 | <style> |
5 | | - html, |
6 | 5 | body { |
7 | | - position: relative; |
8 | | - width: 100%; |
9 | | - height: 100%; |
10 | | - } |
11 | | - |
12 | | - body { |
13 | | - color: #333; |
14 | | - margin: 0; |
15 | | - padding: 8px; |
16 | | - box-sizing: border-box; |
17 | | - font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, |
18 | | - Cantarell, 'Helvetica Neue', sans-serif; |
| 6 | + --bg-1: hsl(0, 0%, 100%); |
| 7 | + --bg-2: hsl(206, 20%, 90%); |
| 8 | + --bg-3: hsl(206, 20%, 80%); |
| 9 | + --fg-1: hsl(0, 0%, 13%); |
| 10 | + --fg-2: hsl(0, 0%, 20%); |
| 11 | + --fg-2: hsl(0, 0%, 30%); |
| 12 | + --link: hsl(208, 77%, 47%); |
| 13 | + --link-hover: hsl(208, 77%, 55%); |
| 14 | + --link-active: hsl(208, 77%, 40%); |
| 15 | + --border-radius: 4px; |
| 16 | + --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, |
| 17 | + 'Open Sans', 'Helvetica Neue', sans-serif; |
| 18 | + --font-mono: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, |
| 19 | + 'DejaVu Sans Mono', monospace; |
| 20 | + color-scheme: light; |
| 21 | + background: var(--bg-1); |
| 22 | + color: var(--fg-1); |
| 23 | + font-family: var(--font); |
| 24 | + line-height: 1.5; |
| 25 | + margin: 1rem; |
| 26 | + height: calc(100vh - 2rem); |
| 27 | + accent-color: var(--hover) !important; |
19 | 28 | } |
20 | 29 |
|
21 | 30 | a { |
22 | | - color: rgb(0, 100, 200); |
23 | | - text-decoration: none; |
| 31 | + color: var(--link); |
24 | 32 | } |
25 | 33 |
|
26 | 34 | a:hover { |
27 | | - text-decoration: underline; |
28 | | - } |
29 | | - |
30 | | - a:visited { |
31 | | - color: rgb(0, 80, 160); |
| 35 | + color: var(--link-hover); |
32 | 36 | } |
33 | 37 |
|
34 | | - label { |
35 | | - display: block; |
| 38 | + a:active { |
| 39 | + color: var(--link-active); |
36 | 40 | } |
37 | 41 |
|
38 | | - input, |
39 | | - button, |
40 | | - select, |
41 | | - textarea { |
42 | | - font-family: inherit; |
43 | | - font-size: inherit; |
44 | | - -webkit-padding: 0.4em 0; |
45 | | - padding: 0.4em; |
46 | | - margin: 0 0 0.5em 0; |
47 | | - box-sizing: border-box; |
48 | | - border: 1px solid #ccc; |
49 | | - border-radius: 2px; |
| 42 | + code { |
| 43 | + background: var(--bg-2); |
| 44 | + font-family: var(--font-mono); |
| 45 | + font-size: 0.9em; |
| 46 | + padding: 0.15rem 0.3rem; |
| 47 | + border-radius: var(--border-radius); |
50 | 48 | } |
51 | 49 |
|
52 | | - input[type='range'] { |
53 | | - padding: 0.4em 0; |
| 50 | + ul.todos { |
| 51 | + padding: 0; |
54 | 52 | } |
55 | 53 |
|
56 | | - input:disabled { |
57 | | - color: #ccc; |
58 | | - } |
59 | | - |
60 | | - button { |
61 | | - color: #333; |
62 | | - background-color: #f4f4f4; |
63 | | - outline: none; |
64 | | - } |
65 | | - |
66 | | - button:disabled { |
67 | | - color: #999; |
68 | | - } |
69 | | - |
70 | | - button:not(:disabled):active { |
71 | | - background-color: #ddd; |
72 | | - } |
73 | | - |
74 | | - button:focus { |
75 | | - border-color: #666; |
76 | | - } |
77 | | - |
78 | | - @media (prefers-color-scheme: dark) { |
79 | | - body { |
80 | | - background: hsl(0, 0%, 18%); |
81 | | - color: hsl(0, 0%, 90%); |
82 | | - } |
| 54 | + body.dark { |
| 55 | + color-scheme: dark; |
| 56 | + --bg-1: hsl(0, 0%, 18%); |
| 57 | + --bg-2: hsl(0, 0%, 30%); |
| 58 | + --bg-3: hsl(0, 0%, 40%); |
| 59 | + --fg-1: hsl(0, 0%, 90%); |
| 60 | + --fg-2: hsl(0, 0%, 70%); |
| 61 | + --fg-3: hsl(0, 0%, 60%); |
| 62 | + --link: hsl(206, 96%, 72%); |
| 63 | + --link-hover: hsl(206, 96%, 78%); |
| 64 | + --link-active: hsl(206, 96%, 64%); |
83 | 65 | } |
84 | 66 | </style> |
85 | 67 |
|
|
93 | 75 | const send_error = (message, stack) => |
94 | 76 | send_reply({ action: 'cmd_error', message, stack }); |
95 | 77 |
|
| 78 | + if (action === 'set_theme') { |
| 79 | + const { theme } = ev.data.args; |
| 80 | + |
| 81 | + document.body.classList.toggle('dark', theme === 'dark'); |
| 82 | + send_ok(); |
| 83 | + } |
| 84 | + |
96 | 85 | if (action === 'eval') { |
97 | 86 | try { |
98 | 87 | const { script } = ev.data.args; |
|
0 commit comments