Files: e82f383b2cc56a63e4afa6eb79a83f8b874713f6 / app / sync / initialize / styles.js
916 bytesRaw
1 | const nest = require('depnest') |
2 | const { h, computed } = require('mutant') |
3 | const values = require('lodash/values') |
4 | |
5 | exports.gives = nest('app.sync.initialize') |
6 | |
7 | exports.needs = nest({ |
8 | 'styles.css': 'reduce', |
9 | 'settings.obs.get': 'first' |
10 | }) |
11 | |
12 | const darkMod = ` |
13 | body { |
14 | filter: invert(88%); |
15 | } |
16 | |
17 | body .Page img { |
18 | filter: invert(); |
19 | } |
20 | .Option > div.circle > i > img { |
21 | filter: none; |
22 | } |
23 | div.Thumbnail { |
24 | filter: invert(); |
25 | } |
26 | body .Lightbox img { |
27 | filter: invert(); |
28 | } |
29 | ` |
30 | |
31 | exports.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