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

Default REPL output is difficult to read on light background #28690

Open
eschnett opened this issue Aug 16, 2018 · 10 comments · Fixed by #49586
Open

Default REPL output is difficult to read on light background #28690

eschnett opened this issue Aug 16, 2018 · 10 comments · Fixed by #49586
Labels
REPL Julia's REPL (Read Eval Print Loop)

Comments

@eschnett
Copy link
Contributor

I'm using Julia on macOS, and my terminals have a light (almost white) background. The default color scheme of the REPL is difficult to read there, as e.g. yellow (for warnings) is almost unreadable.

This page has some hints for how to automatically detect whether the terminal background is light or dark.

@KristofferC
Copy link
Sponsor Member

For reference, the following env vars can be set to customize the colors, e.g.:

ENV["JULIA_ERROR_COLOR"] = :magenta
ENV["JULIA_WARN_COLOR"] = :yellow
ENV["JULIA_INFO_COLOR"] = :cyan

@eschnett
Copy link
Contributor Author

Yes, I'm doing this. There are two problems: (1) It's not the default, and (2) this doesn't affect other parts of Julia, e.g. the package manager which still uses light grey for its status output.

I'm thinking that a function has_light_background in REPL's Terminals.jl (next to hascolor there) would make sense?

@JeffBezanson JeffBezanson added the REPL Julia's REPL (Read Eval Print Loop) label Aug 16, 2018
@ckoe-bccms
Copy link

ckoe-bccms commented Aug 17, 2018

Yes, having readable pkg status would be great. Eventually forcing everything to use just the terminals foreground color (effectively monochrome) might be the simplest temporary solution to do ?
Edit: forcing monochrome if requested by the user of course.

@KristofferC
Copy link
Sponsor Member

You could always start julia with --color=no.

@ckoe-bccms
Copy link

Ah, sorry for the noise then !

@vtjnash
Copy link
Sponsor Member

vtjnash commented Oct 27, 2020

While the PR to autodetect doesn't seem like it will work well, so we haven't merged it in a couple years, I think the --color=light / --color=dark options presented there still have merit, if someone wanted to further develop those idea (there's still a couple days left in hacktoberfest)

@newptcai
Copy link

newptcai commented May 7, 2021

I change the default to

ENV["JULIA_WARN_COLOR"] = :cyan

But it does not seem to have any effect.

@adigitoleo
Copy link
Contributor

Adding some suggestions to the discussion here, after I went through the same experience:

  • Present the --color=no option more visibly in the docs (e.g. at https://docs.julialang.org/en/v1/stdlib/REPL/)
  • The --color=light or --color=dark would help, IIRC IPython has something similar
  • A way to list all REPL element names (similar to Base.text_colors but showing the element->color mapping) would be useful (maybe I missed it?) for figuring out what to put in the startup config.

@adigitoleo
Copy link
Contributor

For reference, here's a quick snippet to get all the "named" colors:

julia> for key in keys(Base.text_colors)
           if isa(key, Symbol)
               println(key)
           end
       end

The names match the base 16 unix/X11/terminal/(?) color names, so you can use a command like (Linux):

msgcat --color=test|head -11

and compare the colors to see which ones you want to change. Preview changes by reassigning to the color dict, e.g.:

julia> Base.text_colors[:white] = Base.text_colors[:red]

When you're happy put the ENV declarations in the config file (see prev comments). So this kind of solves the last bullet point in my other comment.

@tecosaur
Copy link
Contributor

#49586 gave us some new tools to help with this, but I don't think we can consider it quite solved yet.

@tecosaur tecosaur reopened this Oct 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
REPL Julia's REPL (Read Eval Print Loop)
Projects
None yet
8 participants