summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-02-09 23:09:57 +0000
committerjao <jao@gnu.org>2022-02-09 23:10:20 +0000
commitb7ca54651bb12ac7335d525cdd4962c765ec6d0c (patch)
treefd6a1fa665337b2968b29e91f8f348a65ed97f9f
parent6a76c0167499bd525810cd0d4edbb81bae9fdea5 (diff)
downloadxmobar-b7ca54651bb12ac7335d525cdd4962c765ec6d0c.tar.gz
xmobar-b7ca54651bb12ac7335d525cdd4962c765ec6d0c.tar.bz2
"bright" ansi colour names
See #606 for further discussion
-rw-r--r--src/Xmobar/Text/Ansi.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/Xmobar/Text/Ansi.hs b/src/Xmobar/Text/Ansi.hs
index 2f1c2c4..263c661 100644
--- a/src/Xmobar/Text/Ansi.hs
+++ b/src/Xmobar/Text/Ansi.hs
@@ -17,6 +17,7 @@
module Xmobar.Text.Ansi (withAnsiColor) where
import Data.List (intercalate)
+import Data.Char (toLower)
asInt :: String -> String
asInt x = case (reads $ "0x" ++ x) :: [(Integer, String)] of
@@ -25,9 +26,13 @@ asInt x = case (reads $ "0x" ++ x) :: [(Integer, String)] of
namedColor :: String -> String
namedColor c =
- case c of
+ case (map toLower c) of
"black" -> "0"; "red" -> "1"; "green" -> "2"; "yellow" -> "3"; "blue" -> "4";
- "magenta" -> "5"; "cyan" -> "6"; "white" -> "7"; _ -> ""
+ "magenta" -> "5"; "cyan" -> "6"; "white" -> "7";
+ "brightblack" -> "8"; "brightred" -> "9"; "brightgreen" -> "10";
+ "brightyellow" -> "11"; "brightblue" -> "12";
+ "brightmagenta" -> "13"; "brightcyan" -> "14"; "brightwhite" -> "15";
+ _ -> ""
ansiCode :: String -> String
ansiCode ('#':r:g:[b]) = ansiCode ['#', '0', r, '0', g, '0', b]