feat: use system theme by default (#932)

* feat: use system theme by default

* Move logic to default prop

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
This commit is contained in:
Judicael 2022-08-25 11:32:43 +03:00 committed by GitHub
parent 9fbf317046
commit 4285965fab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -102,6 +102,10 @@ export interface TldrawProps extends TDCallbacks {
disableAssets?: boolean
}
const isSystemDarkMode = window.matchMedia
? window.matchMedia('(prefers-color-scheme: dark)').matches
: false
export function Tldraw({
id,
document,
@ -116,7 +120,7 @@ export function Tldraw({
showUI = true,
readOnly = false,
disableAssets = false,
darkMode = false,
darkMode = isSystemDarkMode,
onMount,
onChange,
onChangePresence,