1 ! Copyright (C) 2009 Keith Lazuka.
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
10 CONSTANT: dim-color COLOR: gray35
12 { POSTPONE: USING: POSTPONE: USE: POSTPONE: IN: }
14 { { foreground $ dim-color } }
15 "word-style" set-word-prop
18 PREDICATE: highlighted-word < word [ parsing-word? ] [ delimiter? ] bi or ;
22 GENERIC: word-style ( word -- style )
25 [ presented associate ]
26 [ "word-style" word-prop >hashtable ] bi assoc-union ;
28 M: highlighted-word word-style
29 call-next-method COLOR: DarkSlateGray foreground associate
34 : colored-presentation-style ( obj color -- style )
35 [ presented associate ] [ foreground associate ] bi* assoc-union ;
39 : string-style ( str -- style )
40 COLOR: LightSalmon4 colored-presentation-style ;
42 : vocab-style ( vocab -- style )
43 dim-color colored-presentation-style ;
45 : effect-style ( effect -- style )
46 0 0.2 0 1 <rgba> colored-presentation-style
47 { { font-style plain } } assoc-union ;