@@ -50,6 +50,7 @@ import Data.Word
5050import GHC.Generics
5151import Control.DeepSeq
5252import Text.Printf (printf)
53+import System.Environment (lookupEnv)
5354
5455import qualified System.Console.Terminfo as Terminfo
5556import Control.Exception (catch)
@@ -126,12 +127,15 @@ detectColorMode termName' = do
126127 (\(_ :: Terminfo.SetupTermError) -> return Nothing)
127128 let getCap cap = term >>= \t -> Terminfo.getCapability t cap
128129 termColors = fromMaybe 0 $ getCap (Terminfo.tiGetNum "colors")
130+ colorterm <- lookupEnv "COLORTERM"
129131 return $ if
130− | termColors < 8 -> NoColor
131− | termColors < 16 -> ColorMode8
132− | termColors == 16 -> ColorMode16
133− | termColors < 256 -> ColorMode240 (fromIntegral termColors - 16)
134− | otherwise -> ColorMode240 240
132+ | termColors < 8 -> NoColor
133+ | termColors < 16 -> ColorMode8
134+ | termColors == 16 -> ColorMode16
135+ | termColors < 256 -> ColorMode240 (fromIntegral termColors - 16)
136+ | colorterm == Just "truecolor" -> FullColor
137+ | colorterm == Just "24bit" -> FullColor
138+ | otherwise -> ColorMode240 240
135139
136140black, red, green, yellow, blue, magenta, cyan, white :: Color
137141black = ISOColor 0