]> gitweb.factorcode.org Git - factor.git/blob - basis/ui/theme/switching/switching.factor
ui: disable default-theme? for now.
[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 fonts hashtables help.stylesheet help.tips
4 io.styles kernel listener namespaces prettyprint.stylesheet
5 sequences 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     ! fonts
15     text-color default-font-foreground-color set-global
16     content-background default-font-background-color set-global
17
18     ! help.stylesheet
19     default-style text-color foreground update-style
20     link-style link-color foreground update-style
21     title-style title-color foreground update-style
22     title-style help-header-background page-color update-style
23     help-path-style help-path-border-color table-border update-style
24     heading-style heading-color foreground update-style
25     snippet-style snippet-color foreground update-style
26     code-style code-background-color page-color update-style
27     output-style output-color foreground update-style
28     url-style link-color foreground update-style
29     warning-style warning-background-color page-color update-style
30     warning-style warning-border-color border-color update-style
31     deprecated-style deprecated-background-color page-color update-style
32     deprecated-style deprecated-border-color border-color update-style
33     table-style table-border-color table-border update-style
34
35     ! help.tips
36     tip-of-the-day-style tip-background-color page-color update-style
37
38     ! ui.tools.listener
39     listener-input-style text-color foreground update-style
40     listener-word-style text-color foreground update-style
41
42     ! prettyprint.stylesheet
43     { POSTPONE: USING: POSTPONE: USE: POSTPONE: IN: }
44     [ "word-style" word-prop [ dim-color foreground  ] dip set-at ] each
45     base-word-style text-color foreground update-style
46     highlighted-word-style highlighted-word-color foreground update-style
47     base-string-style string-color foreground update-style
48     base-vocab-style dim-color foreground update-style
49     base-effect-style stack-effect-color foreground update-style
50
51     ! listener
52     prompt-style prompt-background-color background update-style
53     prompt-style text-color foreground update-style
54
55     ! vocabs.prettyprint
56     manifest-style vocab-background-color page-color update-style
57     manifest-style vocab-border-color border-color update-style ;
58
59 PRIVATE>
60
61 : switch-theme ( theme -- )
62     theme set-global update-stylesheet ;
63
64 : light-mode ( -- ) light-theme switch-theme ;
65
66 : dark-mode ( -- ) dark-theme switch-theme ;