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

ANSI colored output in captured stdout #2148

Merged
merged 3 commits into from
Jun 2, 2022
Merged

Conversation

HirumalPriyashan
Copy link
Contributor

@github-actions
Copy link
Contributor

github-actions bot commented Jun 2, 2022

Try this Pull Request!

Open Julia and type:

julia> import Pkg
julia> Pkg.activate(temp=true)
julia> Pkg.add(url="https://github.com/HirumalPriyashan/Pluto.jl", rev="ansi")
julia> using Pluto

@fonsp
Copy link
Owner

fonsp commented Jun 2, 2022

Nice! You can set :color => true here

const default_stdout_iocontext = IOContext(devnull, :color => false, :limit => true, :displaysize => (18, 75), :is_pluto => false)
to tell Julia packages that they can write to stdout in color.

Can you also make a screenshot of Crayons.jl?

@fonsp fonsp linked an issue Jun 2, 2022 that may be closed by this pull request
@fonsp fonsp added frontend Concerning the HTML editor logging About `@info`, `@warn`, etc labels Jun 2, 2022
@HirumalPriyashan
Copy link
Contributor Author

HirumalPriyashan commented Jun 2, 2022

image

Seems we are losing underline, bold etc.

@fonsp
Copy link
Owner

fonsp commented Jun 2, 2022

Nice! Looks like we were using AnsiUp incorrectly, which is why the second cell in your screenshot was shown in red (this state was remaining after rendering the first cell). I added a commit to fix that
Schermafbeelding 2022-06-03 om 00 43 36

@fonsp fonsp merged commit d1ebade into fonsp:main Jun 2, 2022
@fonsp
Copy link
Owner

fonsp commented Jun 2, 2022

image

Maybe #2088 next? :)

@HirumalPriyashan
Copy link
Contributor Author

HirumalPriyashan commented Jun 2, 2022

@fonsp
Let's update ansi_up version too.

<script src="https://cdn.jsdelivr.net/npm/ansi_up@5.0.1/ansi_up.min.js" defer></script>

@v5.1.0 supports underline, italic as well.

@icweaver
Copy link
Contributor

icweaver commented Jun 3, 2022

oh heck this is cool!

@fonsp
Copy link
Owner

fonsp commented Jun 3, 2022

Oooh awesome, lets do that!

@rafaqz
Copy link

rafaqz commented Jan 5, 2023

Is this meant to work with regular show text/plain output now? I notice say DimensionalData.jl output is coloured in the REPL but single color in Pluto.jl, losing a lot of useful information.

@fonsp
Copy link
Owner

fonsp commented Mar 7, 2023

@rafaqz Could you post a MWE?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend Concerning the HTML editor logging About `@info`, `@warn`, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ANSI colored output in captured stdout
4 participants