use os detection for initial dark mode setting

This commit is contained in:
David Lechner
2021-01-15 10:54:57 -06:00
parent 8f71ace56d
commit b38a47f4e6
3 changed files with 39 additions and 1 deletions
+3
View File
@@ -1,6 +1,8 @@
// SPDX-License-Identifier: MIT
// Copyright (c) 2021 The Pybricks Authors
import { prefersDarkMode } from '../utils/os';
// Definitions for user settings.
export enum SettingId {
@@ -14,6 +16,7 @@ export function getDefaultBooleanValue(id: SettingId): boolean {
case SettingId.ShowDocs:
return window.innerWidth >= 1024;
case SettingId.DarkMode:
return prefersDarkMode();
case SettingId.FlashCurrentProgram:
return false;
// istanbul ignore next: it is a programmer error if we hit this