module Agda.Utils.IO.Terminal where
import System.Console.ANSI ( hSupportsANSI )
import System.Environment ( lookupEnv )
import System.IO ( stdout )
import Agda.Utils.Monad ( and2M )
environmentColor :: IO Bool
environmentColor :: IO Bool
environmentColor = Maybe String -> Bool
forall a. Maybe a -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null (Maybe String -> Bool) -> IO (Maybe String) -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> IO (Maybe String)
lookupEnv String
"NO_COLOR"
stdoutSupportsANSI :: IO Bool
stdoutSupportsANSI :: IO Bool
stdoutSupportsANSI = IO Bool
environmentColor IO Bool -> IO Bool -> IO Bool
forall (m :: * -> *). Monad m => m Bool -> m Bool -> m Bool
`and2M` Handle -> IO Bool
hSupportsANSI Handle
stdout