git ssb

2+

mixmix / ticktack



Tree: 804b24d8cddfc3e10bfebea176fdb4109178fcd6

Files: 804b24d8cddfc3e10bfebea176fdb4109178fcd6 / app / sync / initialize / styles.js

916 bytesRaw
1const nest = require('depnest')
2const { h, computed } = require('mutant')
3const values = require('lodash/values')
4
5exports.gives = nest('app.sync.initialize')
6
7exports.needs = nest({
8 'styles.css': 'reduce',
9 'settings.obs.get': 'first'
10})
11
12const darkMod = `
13body {
14 filter: invert(88%);
15}
16
17body .Page img {
18 filter: invert();
19}
20.Option > div.circle > i > img {
21 filter: none;
22}
23div.Thumbnail {
24 filter: invert();
25}
26body .Lightbox img {
27 filter: invert();
28}
29`
30
31exports.create = (api) => {
32 return nest({
33 'app.sync.initialize': function initializeStyles () {
34 console.log('> initialise: styles')
35 const css = values(api.styles.css()).join('\n')
36
37 document.head.appendChild(
38 h('style', {
39 innerHTML: computed(api.settings.obs.get('ticktack.theme'), theme => {
40 return [css, theme === 'dark' ? darkMod : ''].join('\n')
41 })
42 })
43 )
44 }
45 })
46}
47

Built with git-ssb-web