From b7ca54651bb12ac7335d525cdd4962c765ec6d0c Mon Sep 17 00:00:00 2001 From: jao Date: Wed, 9 Feb 2022 23:09:57 +0000 Subject: "bright" ansi colour names See #606 for further discussion --- src/Xmobar/Text/Ansi.hs | 9 +++++++-- 1 file 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] -- cgit v1.2.3