Pluto.jl
Pluto.jl copied to clipboard
IOContext not properly set for `stdout`, disables ANSI colors
Since #2148 the stdout
capture window supports ANSI terminal colors, and :color => true
is set in default_stdout_iocontext
as seen here:
https://github.com/fonsp/Pluto.jl/blob/216451c3c839d1c3c6c50a0b69ba1b8297cceb43/src/runner/PlutoRunner/src/PlutoRunner.jl#L1007-L1012
However, when querying stdout
in a Pluto cell, :color
is set to false
, so well-behaved Julia code will not print colors. MWE: printstyled("hello"; color=:red)
. A workaround is to wrap stdout
in your own IOContext
and set :color => true
, but this should not be necessary.
(Please take this screenshot in place of a video. Nothing dynamic here.)
Notebook file: https://gist.github.com/danielwe/0663e49fbfb2219b2230d3fe2092c097
Using Pluto 0.19.39 on Julia 1.10.1