! See http://factorcode.org/license.txt for BSD license
USING: accessors colors combinators formatting grouping kernel
-lexer math math.parser sequences ;
+lexer math math.parser sequences vocabs.loader ;
IN: colors.hex
[ red>> ] [ green>> ] [ blue>> ] tri
[ 255 * >integer ] tri@ "%02X%02X%02X" sprintf ;
-SYNTAX: HEXCOLOR: scan-token hex>rgba suffix! ;
+TUPLE: hex-color < color hex value ;
+
+M: hex-color >rgba value>> >rgba ;
+
+SYNTAX: HEXCOLOR: scan-token dup hex>rgba hex-color boa suffix! ;
+
+{ "colors.hex" "prettyprint" } "colors.hex.prettyprint" require-when
--- /dev/null
+USING: accessors colors.hex prettyprint.custom
+prettyprint.backend prettyprint.sections ;
+
+IN: colors.hex.prettyprint
+
+M: hex-color pprint* \ HEXCOLOR: [ hex>> text ] pprint-prefix ;