clock: revert removal of initial media query check

This commit restores a small check for a match of the query,
so that when you load in dark mode, the clock loads in dark(ly).
Without this commit, it would only shift modes as part of a media query
change.
This commit is contained in:
Matilde Park 2020-03-09 20:57:13 -04:00
parent f4a06589c0
commit e8b087ea87

View File

@ -18,6 +18,11 @@ let text = "#000000", background = "#ffffff";
let dark = window.matchMedia('(prefers-color-scheme: dark)');
if (dark.matches) {
text = "#7f7f7f";
background = "#333";
}
function darkColors(dark) {
if (dark.matches) {
text = "#7f7f7f";
@ -28,7 +33,7 @@ function darkColors(dark) {
}
}
dark.addListener(darkColors)
dark.addListener(darkColors);
const toRelativeTime = (date, referenceTime, unit) => moment(date)