diff --git a/index.html b/index.html
index 9cf2e13472..c694a541c4 100644
--- a/index.html
+++ b/index.html
@@ -28,7 +28,6 @@
-->
+
${self._view.iconpanel}
${self._view.sidepanel}
${self._components.resizeFeature.render()}
@@ -215,6 +239,12 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
// ----------------- theme servive ----------------------------
const themeModule = new ThemeModule(registry)
registry.put({api: themeModule, name: 'themeModule'})
+ themeModule.initTheme(() => {
+ setTimeout(() => {
+ document.body.removeChild(self._view.splashScreen)
+ self._view.el.style.visibility = 'visible'
+ }, 1500)
+ })
// ----------------- editor servive ----------------------------
const editor = new Editor({}, themeModule) // wrapper around ace editor
registry.put({api: editor, name: 'editor'})
diff --git a/src/app/tabs/theme-module.js b/src/app/tabs/theme-module.js
index 3d5929a98b..b13355f97d 100644
--- a/src/app/tabs/theme-module.js
+++ b/src/app/tabs/theme-module.js
@@ -1,6 +1,7 @@
import { Plugin } from '@remixproject/engine'
import { EventEmitter } from 'events'
import * as packageJson from '../../../package.json'
+import yo from 'yo-yo'
const themes = [
{name: 'Dark', quality: 'dark', url: 'https://res.cloudinary.com/dvtmp0niu/raw/upload/v1578991867/remix-dark-theme.css'},
@@ -52,6 +53,21 @@ export class ThemeModule extends Plugin {
return Object.keys(this.themes).map(key => this.themes[key])
}
+ /**
+ * Init the theme
+ */
+ initTheme (callback) {
+ if (this.active) {
+ const nextTheme = this.themes[this.active] // Theme
+ document.documentElement.style.setProperty('--theme', nextTheme.quality)
+ const theme = yo``
+ theme.addEventListener('load', () => {
+ if (callback) callback()
+ })
+ document.head.appendChild(theme)
+ }
+ }
+
/**
* Change the current theme
* @param {string} [themeName] - The name of the theme