mirror of
https://github.com/liriliri/eruda.git
synced 2026-04-01 10:18:35 +08:00
feat: use dark theme for dark mode
This commit is contained in:
@@ -11,7 +11,8 @@ import {
|
||||
each,
|
||||
isNum,
|
||||
$,
|
||||
throttle
|
||||
throttle,
|
||||
MediaQuery
|
||||
} from '../lib/util'
|
||||
import evalCss from '../lib/evalCss'
|
||||
|
||||
@@ -142,7 +143,7 @@ export default class DevTools extends Emitter {
|
||||
const cfg = (this.config = Settings.createCfg('dev-tools', {
|
||||
transparency: 1,
|
||||
displaySize: 80,
|
||||
theme: 'Light'
|
||||
theme: isDarkMode() ? 'Dark' : 'Light'
|
||||
}))
|
||||
|
||||
this._setTransparency(cfg.get('transparency'))
|
||||
@@ -265,3 +266,8 @@ export default class DevTools extends Emitter {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function isDarkMode() {
|
||||
const m = new MediaQuery('(prefers-color-scheme: dark)')
|
||||
return m.isMatch()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user