futhark-0.15.7: src/Futhark/Util/Console.hs
-- | Some utility functions for working with pretty console output.
module Futhark.Util.Console
( color
, inRed
, inGreen
, inBold
)
where
import System.Console.ANSI
-- | Surround the given string with the given start/end colour codes.
color :: [SGR] -> String -> String
color sgr s = setSGRCode sgr ++ s ++ setSGRCode [Reset]
-- | Make the string red.
inRed :: String -> String
inRed s = setSGRCode [SetColor Foreground Vivid Red] ++ s ++ setSGRCode [Reset]
-- | Make the string green.
inGreen :: String -> String
inGreen s = setSGRCode [SetColor Foreground Vivid Red] ++ s ++ setSGRCode [Reset]
-- | Make the string bold.
inBold :: String -> String
inBold s = setSGRCode [SetConsoleIntensity BoldIntensity] ++ s ++ setSGRCode [Reset]