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:
parent
9fbf317046
commit
4285965fab
1 changed files with 5 additions and 1 deletions
|
@ -102,6 +102,10 @@ export interface TldrawProps extends TDCallbacks {
|
||||||
disableAssets?: boolean
|
disableAssets?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isSystemDarkMode = window.matchMedia
|
||||||
|
? window.matchMedia('(prefers-color-scheme: dark)').matches
|
||||||
|
: false
|
||||||
|
|
||||||
export function Tldraw({
|
export function Tldraw({
|
||||||
id,
|
id,
|
||||||
document,
|
document,
|
||||||
|
@ -116,7 +120,7 @@ export function Tldraw({
|
||||||
showUI = true,
|
showUI = true,
|
||||||
readOnly = false,
|
readOnly = false,
|
||||||
disableAssets = false,
|
disableAssets = false,
|
||||||
darkMode = false,
|
darkMode = isSystemDarkMode,
|
||||||
onMount,
|
onMount,
|
||||||
onChange,
|
onChange,
|
||||||
onChangePresence,
|
onChangePresence,
|
||||||
|
|
Loading…
Reference in a new issue