DynamicLog.hs: Add dzenColor

This commit is contained in:
Eric Mertens
2007-10-18 17:45:23 +00:00
parent c80bf1e5eb
commit 61ed28a72b

View File

@@ -29,7 +29,7 @@ module XMonadContrib.DynamicLog (
pprWindowSetXinerama, pprWindowSetXinerama,
PP(..), defaultPP, sjanssenPP, PP(..), defaultPP, sjanssenPP,
wrap, xmobarColor, shorten wrap, dzenColor, xmobarColor, shorten
) where ) where
-- --
@@ -137,7 +137,13 @@ shorten n xs | length xs < n = xs
sepBy :: String -> [String] -> String sepBy :: String -> [String] -> String
sepBy sep = concat . intersperse sep . filter (not . null) sepBy sep = concat . intersperse sep . filter (not . null)
-- TODO dzenColor dzenColor :: String -> String -> String -> String
dzenColor fg bg = wrap (fg1++bg1) (fg2++bg2)
where (fg1,fg2) | null fg = ("","")
| otherwise = ("^fg(" ++ fg ++ ")","^fg()")
(bg1,bg2) | null bg = ("","")
| otherwise = ("^bg(" ++ bg ++ ")","^bg()")
xmobarColor :: String -> String -> String -> String xmobarColor :: String -> String -> String -> String
xmobarColor fg bg = wrap t "</fc>" xmobarColor fg bg = wrap t "</fc>"
where t = concat ["<fc=", fg, if null bg then "" else "," ++ bg, ">"] where t = concat ["<fc=", fg, if null bg then "" else "," ++ bg, ">"]