I try to use terminal colors within my ghci prompt.
So when I open ghci
and try to:
Prelude> :set prompt '\[\033[1haskell > \033[0m\]'
'\[\033[1\]haskell> \[\033[0m\] '
I know that these codes are interpreted by bash with echo
and the -e
flag. But how can I do this within ghci?
According to https://wiki.haskell.org/GHCi_in_colour, you can use
:set prompt "\ESC[33m\STXhaskell > \ESC[m\STX"
A few notes of explanation:
\STX
corresponds to the \]
of your bash
prompt; \[
as well. (Perhaps it does; I haven't played with this much.)