Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IOContext not properly set for stdout, disables ANSI colors #2823

Closed
danielwe opened this issue Feb 21, 2024 · 0 comments · Fixed by #2824
Closed

IOContext not properly set for stdout, disables ANSI colors #2823

danielwe opened this issue Feb 21, 2024 · 0 comments · Fixed by #2824
Labels
backend Concerning the julia server and runtime enhancement New feature or request good first issue Good for newcomers help welcome If you are experienced in this topic - let us know!

Comments

@danielwe
Copy link
Contributor

Since #2148 the stdout capture window supports ANSI terminal colors, and :color => true is set in default_stdout_iocontext as seen here:

const default_stdout_iocontext = IOContext(devnull,
:color => true,
:limit => true,
:displaysize => (18, 75),
:is_pluto => false,
)

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.

image
(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

@fonsp fonsp added enhancement New feature or request help welcome If you are experienced in this topic - let us know! good first issue Good for newcomers backend Concerning the julia server and runtime labels Aug 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Concerning the julia server and runtime enhancement New feature or request good first issue Good for newcomers help welcome If you are experienced in this topic - let us know!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants