! Copyright (C) 2004, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
-USING: accessors assocs combinators destructors html io
+USING: accessors assocs colors combinators destructors html io
io.styles kernel make math math.functions math.parser sequences
strings xml.syntax ;
IN: html.streams
: href-link-tag ( xml style -- xml )
href of [ simple-link ] when* ;
-: hex-color, ( color -- )
- [ red>> ] [ green>> ] [ blue>> ] tri
- [ 255 * round >integer >hex 2 CHAR: 0 pad-head % ] tri@ ;
-
: fg-css, ( color -- )
- "color: #" % hex-color, "; " % ;
+ "color: " % color>hex % "; " % ;
: bg-css, ( color -- )
- "background-color: #" % hex-color, "; " % ;
+ "background-color: " % color>hex % "; " % ;
: style-css, ( flag -- )
dup
end-sub-stream format-html-span ;
: border-css, ( border -- )
- "border: 1px solid #" % hex-color, "; " % ;
+ "border: 1px solid " % color>hex % "; " % ;
: (padding-css,) ( horizontal vertical -- )
2dup = [