summaryrefslogtreecommitdiffhomepage
path: root/Parsers.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Parsers.hs')
-rw-r--r--Parsers.hs15
1 files 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 "<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 =