1 ! Copyright (C) 2009 Keith Lazuka, Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: assocs colors combinators
4 combinators.short-circuit hashtables io.styles kernel literals
5 namespaces sequences ui.gadgets.theme words words.symbol ;
6 IN: prettyprint.stylesheet
10 { POSTPONE: USING: POSTPONE: USE: POSTPONE: IN: }
12 { { foreground $ dim-color } }
13 "word-style" set-word-prop
16 PREDICATE: highlighted-word < word [ parsing-word? ] [ delimiter? ] bi or ;
20 GENERIC: word-style ( word -- style )
23 [ presented associate ]
24 [ "word-style" word-prop ] bi assoc-union! ;
26 M: highlighted-word word-style
28 highlighted-word-color foreground pick set-at ;
32 : colored-presentation-style ( obj color -- style )
34 [ presented foreground ] dip
35 [ set-at ] curry bi-curry@ bi*
40 : string-style ( str -- style )
41 string-color colored-presentation-style ;
43 : vocab-style ( vocab -- style )
44 dim-color colored-presentation-style ;
46 SYMBOL: stack-effect-style
49 { foreground $ stack-effect-color }
51 } stack-effect-style set-global
53 : effect-style ( effect -- style )
54 presented associate stack-effect-style get assoc-union! ;