I run the following in drracket:
#lang racket/base
(require ansi-color)
(printf "plain text~n")
(with-colors 'red (lambda () (printf "red text~n")))
(with-colors 'green (lambda () (printf "green text~n")))
In the output window all the printf'd text appears in purple on a black background,, which are my usual default colours.
None of it is red or green.
The ansi colour escapes show up in purple too, introduced with a boxed hexadecimall character.
In case it is relevant, I use drracket in dark mode, and I have configured it to present parantheses in code in yellow -- so I can see these all-important charcters.
I use printf while debugging, and I'd like to use colour to emphasize milestones in printf trace output.
-- hendrik