From 9192f3664b07b161a1c4120e889e37100824b16a Mon Sep 17 00:00:00 2001 From: Krzysztof Kosciuszkiewicz Date: Fri, 6 Jul 2007 03:01:24 +0200 Subject: Add support for named colors. If bad color name is specified then exception is thrown by Xlib. This should be probably handled in a more elegant way. darcs-hash:20070706010124-ba08c-86d9d978d9f86348f552a1e2ebbdec18b21ff271.gz --- Parsers.hs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Parsers.hs b/Parsers.hs index 6ca318c..6feea97 100644 --- a/Parsers.hs +++ b/Parsers.hs @@ -59,15 +59,24 @@ defaultColors config = -- | Parses a string with a color set colorsAndText :: Config -> Parser (String, String) colorsAndText config = - do { string "" ; s <- many $ noneOf "<" ; string "" - ; return (s,"#"++n) + ; return (s,c) } <|> defaultColors config +-- | Parses a color specification (hex or named) +colorSpec :: Parser String +colorSpec = + do { c <- char '#' + ; s <- count 6 hexDigit + ; return $ c:s + } + <|> many1 alphaNum + -- | Parses the output template string templateStringParser :: Config -> Parser (String,String,String) templateStringParser c = -- cgit v1.2.3