Skip to content

Commit 18d4741

Browse files
committed
Add dark mode and full-screen the cart
1 parent c3ef0fb commit 18d4741

1 file changed

Lines changed: 30 additions & 4 deletions

File tree

index.html

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,35 @@
88
<link rel="icon" href="assets/icons/icon512_rounded.png" type="image/png">
99
<link href="https://cdn.jsdelivr.net/npm/uplot@1.6.31/dist/uPlot.min.css" rel="stylesheet">
1010
<style>
11+
:root {
12+
color-scheme: light dark;
13+
}
14+
15+
body {
16+
color: CanvasText;
17+
background-color: Canvas;
18+
margin: 0;
19+
}
20+
1121
.u-value {
1222
font-family: monospace;
23+
vertical-align: bottom;
24+
}
25+
26+
button#connect {
27+
position: absolute;
28+
top: 1rem;
29+
left: 6rem;
30+
z-index: 10;
1331
}
1432
</style>
1533
</head>
1634
<body>
17-
<button>connect</button>
35+
<button id="connect">connect</button>
1836
<script type="module">
1937
import uplot from 'https://cdn.jsdelivr.net/npm/uplot@1.6.31/+esm'
2038

39+
const dark = window.matchMedia('(prefers-color-scheme: dark)').matches
2140
const vendorId = 11836, productId = 44801 // DP100's HID IDs
2241
const deviceAddr = 251 // DP100's device address
2342

@@ -200,10 +219,9 @@
200219
}
201220

202221
let opts = {
203-
title: 'UV Graph',
204222
id: 'uv-graph',
205-
width: 800,
206-
height: 600,
223+
width: window.innerWidth,
224+
height: window.innerHeight - 32,
207225
series: [
208226
{
209227
label: 'Time',
@@ -244,13 +262,21 @@
244262
label: 'Voltage (V)',
245263
value: (self, rawValue) => rawValue === null ? 'N/A' : rawValue.toLocaleString(undefined, { minimumFractionDigits: 3 }) + 'V',
246264
grid: { show: false },
265+
stroke: () => dark ? 'white' : 'black',
266+
ticks: {
267+
stroke: () => dark ? 'white' : 'black',
268+
},
247269
},
248270
{
249271
scale: 'A',
250272
label: 'Current (A)',
251273
value: (self, rawValue) => rawValue === null ? 'N/A' : rawValue.toLocaleString(undefined, { minimumFractionDigits: 3 }) + 'A',
252274
side: 1,
253275
grid: { show: false },
276+
stroke: () => dark ? 'white' : 'black',
277+
ticks: {
278+
stroke: () => dark ? 'white' : 'black',
279+
},
254280
},
255281
{},
256282
],

0 commit comments

Comments
 (0)