diff --git a/basis/prettyprint/stylesheet/stylesheet.factor b/basis/prettyprint/stylesheet/stylesheet.factor index fbd95ecbd2..a593f23d99 100644 --- a/basis/prettyprint/stylesheet/stylesheet.factor +++ b/basis/prettyprint/stylesheet/stylesheet.factor @@ -1,51 +1,46 @@ -! Copyright (C) 2009 Your name. +! Copyright (C) 2009 Keith Lazuka. ! See http://factorcode.org/license.txt for BSD license. -USING: colors.constants combinators combinators.short-circuit -hashtables io.styles kernel namespaces sequences words -words.symbol ; +USING: assocs colors.constants combinators +combinators.short-circuit hashtables io.styles kernel literals +namespaces sequences words words.symbol ; IN: prettyprint.stylesheet -: word-style ( word -- style ) - dup "word-style" word-prop >hashtable [ - [ - [ presented set ] [ word-color foreground set ] bi - ] bind - ] keep ; +GENERIC: word-style ( word -- style ) + +M: word word-style + [ presented associate ] + [ "word-style" word-prop >hashtable ] bi assoc-union ; + +M: highlighted-word word-style + call-next-method COLOR: DarkSlateGray foreground associate + swap assoc-union ; + + : string-style ( str -- style ) - [ - presented set - COLOR: LightSalmon4 foreground set - ] H{ } make-assoc ; + COLOR: LightSalmon4 colored-presentation-style ; : vocab-style ( vocab -- style ) - [ - presented set - dim-color foreground set - ] H{ } make-assoc ; + dim-color colored-presentation-style ; : effect-style ( effect -- style ) - [ - presented set - COLOR: DarkGreen foreground set - ] H{ } make-assoc ; \ No newline at end of file + COLOR: DarkGreen colored-presentation-style ;