--
-- | map strings to colors
--
stringToColor :: String -> Maybe Color
stringToColor s = case map toLower s of
    "black"         -> Just black
    "grey"          -> Just grey
    "darkred"       -> Just darkred
    "red"           -> Just red
    "darkgreen"     -> Just darkgreen
    "green"         -> Just green
    "brown"         -> Just brown
    "yellow"        -> Just yellow
    "darkblue"      -> Just darkblue
    "blue"          -> Just blue
    "purple"        -> Just purple
    "magenta"       -> Just magenta
    "darkcyan"      -> Just darkcyan
    "cyan"          -> Just cyan
    "white"         -> Just white
    "brightwhite"   -> Just brightwhite
    "default"       -> Just Default
    "reverse"       -> Just Reverse
    _               -> Nothing

------------------------------------------------------------------------
--
-- | Set some colours, perform an action, and then reset the colours
--
stringToColor :: String -> Maybe Color
stringToColor s = case map toLower s of
    "black"         -> Just black
    "grey"          -> Just grey
    "darkred"       -> Just darkred
    "red"           -> Just red
    "darkgreen"     -> Just darkgreen
    "green"         -> Just green
    "brown"         -> Just brown
    "yellow"        -> Just yellow
    "darkblue"      -> Just darkblue
    "blue"          -> Just blue
    "purple"        -> Just purple
    "magenta"       -> Just magenta
    "darkcyan"      -> Just darkcyan
    "cyan"          -> Just cyan
    "white"         -> Just white
    "brightwhite"   -> Just brightwhite
    "default"       -> Just Default
    "reverse"       -> Just Reverse
    _               -> Nothing

------------------------------------------------------------------------
--
-- | Set some colours, perform an action, and then reset the colours
--
stringToColor s = case map toLower s of
    "black"         -> Just black
    "grey"          -> Just grey
    "darkred"       -> Just darkred
    "red"           -> Just red
    "darkgreen"     -> Just darkgreen
    "green"         -> Just green
    "brown"         -> Just brown
    "yellow"        -> Just yellow
    "darkblue"      -> Just darkblue
    "blue"          -> Just blue
    "purple"        -> Just purple
    "magenta"       -> Just magenta
    "darkcyan"      -> Just darkcyan
    "cyan"          -> Just cyan
    "white"         -> Just white
    "brightwhite"   -> Just brightwhite
    "default"       -> Just Default
    "reverse"       -> Just Reverse
    _               -> Nothing

------------------------------------------------------------------------
--
-- | Set some colours, perform an action, and then reset the colours
--