]> gitweb.factorcode.org Git - factor.git/blob - basis/prettyprint/stylesheet/stylesheet.factor
ui.theme: updates to color scheme.
[factor.git] / basis / prettyprint / stylesheet / stylesheet.factor
1 ! Copyright (C) 2009 Keith Lazuka, Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: assocs colors colors.constants combinators
4 combinators.short-circuit hashtables io.styles kernel literals
5 namespaces sequences words words.symbol ;
6 IN: prettyprint.stylesheet
7
8 <PRIVATE
9
10 { POSTPONE: USING: POSTPONE: USE: POSTPONE: IN: }
11 [
12     { { foreground COLOR: gray35 } }
13     "word-style" set-word-prop
14 ] each
15
16 PREDICATE: highlighted-word < word [ parsing-word? ] [ delimiter? ] bi or ;
17
18 PRIVATE>
19
20 SYMBOL: base-word-style
21 H{ } base-word-style set-global
22
23 GENERIC: word-style ( word -- style )
24
25 M: word word-style
26     [ presented base-word-style get clone [ set-at ] keep ]
27     [ "word-style" word-prop ] bi assoc-union! ;
28
29 SYMBOL: highlighted-word-style
30 H{
31     { foreground COLOR: DarkSlateGray }
32 } highlighted-word-style set-global
33
34 M: highlighted-word word-style
35     call-next-method highlighted-word-style get assoc-union! ;
36
37 SYMBOL: base-string-style
38 H{
39     { foreground COLOR: LightSalmon4 }
40 } base-string-style set-global
41
42 : string-style ( str -- style )
43     presented base-string-style get clone [ set-at ] keep ;
44
45 SYMBOL: base-vocab-style
46 H{
47     { foreground COLOR: gray35 }
48 } base-vocab-style set-global
49
50 : vocab-style ( vocab -- style )
51     presented base-vocab-style get clone [ set-at ] keep ;
52
53 SYMBOL: stack-effect-style
54 H{
55     { foreground COLOR: FactorDarkGreen }
56     { font-style plain }
57 } stack-effect-style set-global
58
59 : effect-style ( effect -- style )
60     presented stack-effect-style get clone [ set-at ] keep ;