Skip to content

Commit

Permalink
release: v2.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
surunzi committed Nov 26, 2022
1 parent c54ffa1 commit b02ffee
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 2.6.1 (26 Nov 2022)

* fix: dark mode scrollbar style
* fix: unable to load timing plugin

## 2.6.0 (25 Nov 2022)

* feat(console): select and copy
Expand Down
4 changes: 2 additions & 2 deletions build/webpack.analyser.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const BundleAnalyzerPlugin =
require('webpack-bundle-analyzer').BundleAnalyzerPlugin
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer')
.BundleAnalyzerPlugin

exports = require('./webpack.prod')

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eruda",
"version": "2.6.0",
"version": "2.6.1",
"description": "Console for Mobile Browsers",
"main": "eruda.js",
"browserslist": [
Expand Down
15 changes: 13 additions & 2 deletions src/DevTools/DevTools.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
extend,
} from '../lib/util'
import evalCss from '../lib/evalCss'
import { isDarkTheme } from '../lib/themes'
import LunaNotification from 'luna-notification'

export default class DevTools extends Emitter {
Expand Down Expand Up @@ -156,7 +157,7 @@ export default class DevTools extends Emitter {

this._setTransparency(cfg.get('transparency'))
this._setDisplaySize(cfg.get('displaySize'))
evalCss.setTheme(cfg.get('theme'))
this._setTheme(cfg.get('theme'))

cfg.on('change', (key, val) => {
switch (key) {
Expand All @@ -165,7 +166,7 @@ export default class DevTools extends Emitter {
case 'displaySize':
return this._setDisplaySize(val)
case 'theme':
return evalCss.setTheme(val)
return this._setTheme(val)
}
})

Expand Down Expand Up @@ -193,6 +194,16 @@ export default class DevTools extends Emitter {
this._navBar.destroy()
this._$el.remove()
}
_setTheme(theme) {
const { $container } = this

if (isDarkTheme(theme)) {
$container.addClass('eruda-dark')
} else {
$container.rmClass('eruda-dark')
}
evalCss.setTheme(theme)
}
_setTransparency(opacity) {
if (!isNum(opacity)) return

Expand Down
19 changes: 19 additions & 0 deletions src/lib/themes.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { extend, isArr } from './util'
import contain from 'licia/contain'

const keyMap = [
'background',
Expand Down Expand Up @@ -70,6 +71,24 @@ function createLightTheme(theme) {
)
}

const darkThemes = [
'Dark',
'Material Oceanic',
'Material Darker',
'Material Palenight',
'Material Deep Ocean',
'Monokai Pro',
'Dracula',
'Arc Dark',
'Atom One Dark',
'Solarized Dark',
'Night Owl',
]

export function isDarkTheme(theme) {
return contain(darkThemes, theme)
}

export default {
Light: createLightTheme({
darkerBackground: '#f3f3f3',
Expand Down
3 changes: 3 additions & 0 deletions src/style/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
@import 'luna';

.container {
&.dark {
color-scheme: dark;
}
pointer-events: none;
position: fixed;
left: 0;
Expand Down

0 comments on commit b02ffee

Please sign in to comment.