1 ! Copyright (C) 2009 Your name.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: colors.constants combinators combinators.short-circuit
4 hashtables io.styles kernel namespaces sequences words
6 IN: prettyprint.stylesheet
10 CONSTANT: dim-color COLOR: gray35
11 CONSTANT: alt-color COLOR: DarkSlateGray
13 : dimly-lit-word? ( word -- ? )
14 { POSTPONE: USING: POSTPONE: USE: POSTPONE: IN: } memq? ;
16 : parsing-or-delim-word? ( word -- ? )
17 [ parsing-word? ] [ delimiter? ] bi or ;
19 : word-color ( word -- color )
21 { [ dup dimly-lit-word? ] [ drop dim-color ] }
22 { [ dup parsing-or-delim-word? ] [ drop alt-color ] }
28 : word-style ( word -- style )
29 dup "word-style" word-prop >hashtable [
31 [ presented set ] [ word-color foreground set ] bi
35 : string-style ( str -- style )
38 COLOR: LightSalmon4 foreground set
41 : vocab-style ( vocab -- style )
44 dim-color foreground set
47 : effect-style ( effect -- style )
50 COLOR: DarkGreen foreground set