git ssb

2+

mixmix / ticktack



Tree: 67583b0e9605f9e2c2a95ff125a23e8a1cca8953

Files: 67583b0e9605f9e2c2a95ff125a23e8a1cca8953 / 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