Unverified Commit 0cca38bd authored by yann300's avatar yann300 Committed by GitHub

Merge pull request #1897 from ethereum/issue#1896-theme_changed_event

Issue#1896 theme changed event
parents d266db68 6de2c68f
...@@ -35,8 +35,8 @@ class VerticalIconComponent { ...@@ -35,8 +35,8 @@ class VerticalIconComponent {
this.store.event.on('remove', (api) => { }) this.store.event.on('remove', (api) => { })
let themeModule = globalRegistry.get('themeModule').api let themeModule = globalRegistry.get('themeModule').api
themeModule.events.on('themeChanged', (type) => { themeModule.events.on('themeChanged', (theme) => {
this.onThemeChanged(type) this.onThemeChanged(theme.quality)
}) })
} }
......
...@@ -52,8 +52,8 @@ class Editor { ...@@ -52,8 +52,8 @@ class Editor {
'light': 'chrome', 'light': 'chrome',
'dark': 'chaos' 'dark': 'chaos'
} }
this._deps.themeModule.events.on('themeChanged', (type) => { this._deps.themeModule.events.on('themeChanged', (theme) => {
this.setTheme(type) this.setTheme(theme.quality)
}) })
// Init // Init
......
...@@ -57,6 +57,6 @@ export class ThemeModule extends BaseApi { ...@@ -57,6 +57,6 @@ export class ThemeModule extends BaseApi {
document.getElementById('theme-link').setAttribute('href', nextTheme.url) document.getElementById('theme-link').setAttribute('href', nextTheme.url)
document.documentElement.style.setProperty('--theme', nextTheme.quality) document.documentElement.style.setProperty('--theme', nextTheme.quality)
if (themeName) this.active = themeName if (themeName) this.active = themeName
this.events.emit('themeChanged', nextTheme.quality) this.events.emit('themeChanged', nextTheme)
} }
} }
...@@ -161,8 +161,8 @@ export class LandingPage extends BaseApi { ...@@ -161,8 +161,8 @@ export class LandingPage extends BaseApi {
globalRegistry.get('verticalicon').api.select('fileExplorers') globalRegistry.get('verticalicon').api.select('fileExplorers')
} }
globalRegistry.get('themeModule').api.events.on('themeChanged', (type) => { globalRegistry.get('themeModule').api.events.on('themeChanged', (theme) => {
const invert = type === 'dark' ? 1 : 0 const invert = theme.quality === 'dark' ? 1 : 0
const img = document.getElementById('remixLogo') const img = document.getElementById('remixLogo')
if (img) { if (img) {
img.style.filter = `invert(${invert})` img.style.filter = `invert(${invert})`
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment