diff options
Diffstat (limited to 'Parsers.hs')
-rw-r--r-- | Parsers.hs | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -59,15 +59,24 @@ defaultColors config = -- | Parses a string with a color set colorsAndText :: Config -> Parser (String, String) colorsAndText config = - do { string "<fc=#" - ; n <- count 6 hexDigit + do { string "<fc=" + ; c <- colorSpec ; string ">" ; s <- many $ noneOf "<" ; string "</fc>" - ; 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 = |