]> gitweb.factorcode.org Git - factor.git/blob - basis/ui/theme/switching/switching.factor
ui.theme.switching: adding back light-mode and dark-mode.
[factor.git] / basis / ui / theme / switching / switching.factor
1 ! Copyright (C) 2016 Nicolas PĂ©net.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: assocs fry hashtables help.stylesheet help.tips io.styles
4 kernel listener namespaces prettyprint.stylesheet sequences
5 ui.theme ui.tools.listener vocabs.prettyprint words ;
6 IN: ui.theme.switching
7
8 <PRIVATE
9
10 : update-style ( style color elt -- )
11     '[ _ _ rot ?set-at ] change-global ;
12
13 : update-stylesheet ( -- )
14     ! help.stylesheet
15     default-span-style text-color foreground update-style
16     link-style link-color foreground update-style
17     title-style title-color foreground update-style
18     help-path-style help-path-border-color table-border update-style
19     heading-style heading-color foreground update-style
20     snippet-style snippet-color foreground update-style
21     code-style code-background-color page-color update-style
22     output-style output-color foreground update-style
23     url-style link-color foreground update-style
24     warning-style warning-background-color page-color update-style
25     warning-style warning-border-color border-color update-style
26     deprecated-style deprecated-background-color page-color update-style
27     deprecated-style deprecated-border-color border-color update-style
28     table-style table-border-color table-border update-style
29
30     ! help.tips
31     tip-of-the-day-style tip-background-color page-color update-style
32
33     ! ui.tools.listener
34     listener-input-style text-color foreground update-style
35     listener-word-style text-color foreground update-style
36
37     ! prettyprint.stylesheet
38     { POSTPONE: USING: POSTPONE: USE: POSTPONE: IN: }
39     [ "word-style" word-prop [ dim-color foreground  ] dip set-at ] each
40     base-word-style text-color foreground update-style
41     highlighted-word-style highlighted-word-color foreground update-style
42     base-string-style string-color foreground update-style
43     base-vocab-style dim-color foreground update-style
44     stack-effect-style stack-effect-color foreground update-style
45
46     ! listener
47     prompt-style prompt-background-color background update-style
48     prompt-style text-color foreground update-style
49
50     ! vocabs.prettyprint
51     manifest-style vocab-background-color page-color update-style
52     manifest-style vocab-border-color border-color update-style ;
53
54 PRIVATE>
55
56 : switch-theme ( theme -- )
57     theme set-global update-stylesheet ;
58
59 : light-mode ( -- ) light-theme switch-theme ;
60
61 : dark-mode ( -- ) dark-theme switch-theme ;