-- | Set the colour of a string using POSIX escape codes, with trailing '\STX' denoting the end
-- (required by Haskeline in the prompt string)
colouriseWithSTX :: IdrisColour -> String -> String
colouriseWithSTX (IdrisColour c v u b i) str = setSGRCode sgr ++ "\STX" ++ str ++ setSGRCode [Reset] ++ "\STX"
    where sgr = fg c ++
                [SetUnderlining SingleUnderline | u] ++
                [SetConsoleIntensity BoldIntensity | b] ++
                [SetItalicized True | i]
          fg Nothing = []
          fg (Just c) = [SetColor Foreground (if v then Vivid else Dull) c]
colouriseWithSTX :: IdrisColour -> String -> String
colouriseWithSTX (IdrisColour c v u b i) str = setSGRCode sgr ++ "\STX" ++ str ++ setSGRCode [Reset] ++ "\STX"
    where sgr = fg c ++
                [SetUnderlining SingleUnderline | u] ++
                [SetConsoleIntensity BoldIntensity | b] ++
                [SetItalicized True | i]
          fg Nothing = []
          fg (Just c) = [SetColor Foreground (if v then Vivid else Dull) c]
colouriseWithSTX (IdrisColour c v u b i) str = setSGRCode sgr ++ "\STX" ++ str ++ setSGRCode [Reset] ++ "\STX"
    where sgr = fg c ++
                [SetUnderlining SingleUnderline | u] ++
                [SetConsoleIntensity BoldIntensity | b] ++
                [SetItalicized True | i]
          fg Nothing = []
          fg (Just c) = [SetColor Foreground (if v then Vivid else Dull) c]