Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
replace insert-css with mutant style element
Browse files Browse the repository at this point in the history
  • Loading branch information
mmckegg committed Oct 25, 2017
1 parent 9eb1893 commit b68094a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
19 changes: 8 additions & 11 deletions main-window.js
Expand Up @@ -6,7 +6,7 @@ var when = require('mutant/when')
var onceTrue = require('mutant/once-true')
var computed = require('mutant/computed')
var catchLinks = require('./lib/catch-links')
var insertCss = require('insert-css')
var themes = require('./styles')
var nest = require('depnest')
var LatestUpdate = require('./lib/latest-update')
var ref = require('ssb-ref')
Expand Down Expand Up @@ -72,16 +72,13 @@ module.exports = function (config) {
electron.remote.app.setBadgeCount(count)
})


watch(api.settings.obs.get('patchwork.theme', 'light'), name => {
Array.from(document.head.children)
.filter(c => c.tagName == 'STYLE')
.forEach(c => c.innerText = '')

var theme = require('./styles')[name]
if (!theme) theme = require('./styles')['light']
insertCss(theme)
})
document.head.appendChild(
h('style', {
innerHTML: computed(api.settings.obs.get('patchwork.theme', 'light'), themeName => {
return themes[themeName] || themes['light']
})
})
)

var container = h(`MainWindow -${process.platform}`, [
h('div.top', [
Expand Down
1 change: 0 additions & 1 deletion package.json
Expand Up @@ -30,7 +30,6 @@
"hashlru": "^2.2.0",
"human-time": "0.0.1",
"i18n": "^0.8.3",
"insert-css": "~2.0.0",
"level": "~1.7.0",
"lrucache": "^1.0.2",
"micro-css": "^2.0.1",
Expand Down

0 comments on commit b68094a

Please sign in to comment.