In R I can create a custom console prompt via:
options(prompt = "foo> ")
And I can use the crayon package to make it a certain color:
options(prompt = crayon::blue("foo> "))
However, in RStudio, color changes never take effect until the prompt is inactive; i.e. until I hit enter and the current line is replaced with a new prompt.
Like this:
The current console prompt is always yellow. Once I hit enter, a new yellow prompt appears and the previous line moves up and is colored blue.
I do not see this behavior when running R from the command line, the prompt immediately turns blue:
Is there a way around this in RStudio using crayon, or is RStudio short-circuiting the prompt formatting in a way that makes it impossible to fix without a change to the RStudio IDE (meaning I should report a bug/feature request with them)?