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

Stop using bold text for input and answers #11250

Merged
merged 2 commits into from
Jan 25, 2017

Conversation

jayschwa
Copy link
Member

This pull request turns off bold text everywhere and changes it to "normal" text.

Julia should respect the user's font settings; if they really wanted to see bold text everywhere, they presumably would have adjusted it in their terminal's settings. I don't think there's a compelling reason for Julia not to toe the line here. For the existing Julia users who like the good old days, bold text can still be enabled via the JULIA_[INPUT|ANSWER]_COLOR=bold environment variables.

Bold styling should be used conservatively to highlight information. Switching the baseline to normal text opens the door for more intelligent use of bold in the future. 🚀

@StefanKarpinski
Copy link
Member

Normal printed output is non-bold. I find that the difference helps make it clearer what's going on. We already make colored responses opt-in. At this rate, we're headed towards the git situation where 99% of users don't know how to make it look colorful or nice.

@andreasnoack
Copy link
Member

+1. I've had this locally for a while. I agree that bold should only be used for emphasizing pieces of text.

@ssfrr
Copy link
Contributor

ssfrr commented May 17, 2015

This would also resolve #8096 (colors would show up correctly for people using the Solarized colorscheme). Note that (as I mention in that issue) I think that this is basically Solarized's fault for changing the meaning of bold text, but it is a relatively popular theme, and it seems weird to use bold unnecessarily.

@StefanKarpinski isn't the color by itself enough to differentiate from normal printed text? Maybe colored text could print in non-bold color and if color is turned off all colored text just gets bolded instead?

@ViralBShah ViralBShah added the REPL Julia's REPL (Read Eval Print Loop) label May 17, 2015
@andreasnoack
Copy link
Member

I just got annoyed by the bold fonts again. It really makes the text harder to read and I agree with @jayschwa that it is wrong to use bold here so I'm in favor of merging this.

@jayschwa
Copy link
Member Author

jayschwa commented Nov 3, 2015

Rebased from master and resolved merge conflict.

@andreasnoack
Copy link
Member

@jayschwa Thanks. I'll merge tomorrow unless someone objects.

@blakejohnson
Copy link
Contributor

@andreasnoack I didn't sense a consensus on this one, yet.

@hayd
Copy link
Member

hayd commented Nov 3, 2015

Being able to disambiguate at the repl:

f() = println("\"hello\"")
g() = "hello"

seems useful. I don't care about julia> INPUT but output should be emphasized.

@andreasnoack
Copy link
Member

I agree that it should be possible to disambiguate f and g in your example, but I don't think bold is the right choice. IPython, R and Matlab print Out[_x_], [_linenumber_] and ans = respectively before output. We could consider printing something similar or alternatively we could use a different color for output.

@musm
Copy link
Contributor

musm commented Nov 3, 2015

Is it possible to enable bold (or a color) on windows, or is this a linux only feature? I don't have anything bolded.

@jayschwa
Copy link
Member Author

jayschwa commented Nov 4, 2015

@mmoh, Julia on Windows uses non-bold text by default. Bold doesn't appear to do much in a Windows terminal. It brightens the color a bit, but doesn't change the visual weight of the characters. Here's how to play with it:

print_with_color(:bold, "This is bold")

@tkelman
Copy link
Contributor

tkelman commented Nov 4, 2015

I think it should work in mintty though

@andreasnoack
Copy link
Member

@jayschwa Do you have a proposal for distinguishing the return from a function from what is written to STDOUT?

@jayschwa
Copy link
Member Author

jayschwa commented Nov 4, 2015

Is JULIA_ANSWER_COLOR not sufficient?

@andreasnoack
Copy link
Member

I think we should set a default value. :cyan or :magenta would be fine with me.

@jayschwa
Copy link
Member Author

jayschwa commented Nov 4, 2015

Using a prefix seems more in line with what other language REPLs do, but I feel like that falls outside the scope of this PR. I personally can't recall many times where differentiating between a return value and stdout was problematic for me.

@StefanKarpinski
Copy link
Member

I have return values as :magenta which looks quite nice. May even look ok on Windows. IIRC, cyan was bad on Windows.

@andreasnoack
Copy link
Member

Let's try with default output in magenta. Then I think we have a compromise that will eliminate the bold letters and still disambiguate printed output from return values. @jayschwa, if you update then I'll merge.

@jakebolewski
Copy link
Member

NO!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

@jayschwa
Copy link
Member Author

jayschwa commented Nov 9, 2015

NO!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

I concur, I think magenta will be more offensive to my eyes than bold 🙈

I'm skeptical that there is widespread confusion between prints and REPL output. JULIA_ANSWER_COLOR is available for those who want to tweak it.

@andreasnoack
Copy link
Member

@StefanKarpinski Color seems to be a sensitive issue. Should we try without and see if it causes confusion that return values in the REPL and printed output are identical? I like the magenta output idea, but my main priority is to get rid of the bold letters.

@StefanKarpinski
Copy link
Member

Apparently the worst bikeshed is the original: what color to paint the bike shed.

@StefanKarpinski
Copy link
Member

I worry that this now defaults to giving people the least information and the least "fancy" setup. This is kind of like how git defaults to not using colors. As a result, I've seen people who've used git for years with no colors. I turn the option on for them and suddenly the whole experience is changed. I don't want Julia to end up like this. Even if you don't like the default output, at least the use of colors and bold lets you know that colors and bold are an option and something that you can configure.

@jakebolewski
Copy link
Member

Why does bold == fancy? It seems like a subjective opinion. I don't like that you take away bold as an option to emphasize particular output. So it seems like you can add more information to output when bold by default is turned off.

@hayd
Copy link
Member

hayd commented Nov 9, 2015

If it's easy and well documented to turn off the bold, what's the problem?

I'm not sure magenta is a good choice either.

@jayschwa
Copy link
Member Author

jayschwa commented Nov 9, 2015

If it's easy and well documented to turn off the bold, what's the problem?

The problem is outlined in the original post. Matching the terminal's font shouldn't require explicit action, it should happen by default.

@jayschwa
Copy link
Member Author

jayschwa commented Jan 7, 2017

I have rebased the PR off master and replaced some hardcoded ANSI codes with text_colors.

@KristofferC, I did not remove the bold from input_color() and answer_color(). As far as I can tell, they don't actually affect anything. Might be worth investigating!

[Updated]

After playing, I see that input_color() and answer_color() are engaged when one of the JULIA_*_COLOR environment variables is set. Since the hardcoded default is now :normal, it's blowing away the :bold in the function. Anyhow, I'm going to remove the :bold from those functions as well.

@jayschwa jayschwa changed the title Stop using bold text everywhere Stop using bold text for input and answers Jan 7, 2017
@jayschwa jayschwa force-pushed the the-goggles-do-nothing branch 2 times, most recently from 16d346e to 20d7a86 Compare January 7, 2017 06:01
@JeffBezanson
Copy link
Member

👍

@@ -958,7 +956,7 @@ type StreamREPL <: AbstractREPL
waserror::Bool
StreamREPL(stream,pc,ic,ac) = new(stream,pc,ic,ac,false)
end
StreamREPL(stream::IO) = StreamREPL(stream, julia_green, Base.input_color(), Base.answer_color())
StreamREPL(stream::IO) = StreamREPL(stream, Base.text_color[:green], Base.input_color(), Base.answer_color())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be light_green if we want to keep the same color as before.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should also be text_colors, which tells me this line isn't hit by tests at all

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When is this even used?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remote repl maybe? untested stuff that probably only Keno uses?

Copy link
Member Author

@jayschwa jayschwa Jan 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-pushed with the typo fixed. :green was left as-is because that matches what it was before. The only difference is that it no longer contains the code for bold, but it was redundant since bold is prefixed later on by Prompt. The effect remains the same: bold, green julia>.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, because on most terminals (urxvt, gnome-terminal, cmd etc) bold makes text bold AND also makes the color brighter (the light versions of the color).

image

The purpose here is to strip the bold part and not change the color, hence it should be :light_green.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bold is still being applied, just somewhere else, so the color isn't actually changing (nor the bold). I see what you mean though, so I will updated it. It probably makes sense to do the same in the banner too, right?

Copy link
Member

@KristofferC KristofferC Jan 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, if the boldness is still being applied then it doesn't really matter. I remember now that I had to add that here: https://github.com/JuliaLang/julia/pull/18628/files#diff-8dc8200a114faecb709b7b96e96fc0cfR632. Maybe change to light_green and remove that bold part so the prompt is not in bold?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to leave the prompts bold. Changing the color to light_green still might make sense because it decouples the color from its boldness. However, do the light variants work reliably across platforms?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everywhere I have tested, yes. Errors are currently being printed in light_red for example.

@KristofferC
Copy link
Member

KristofferC commented Jan 7, 2017

This needs a NEWS entry preferably with a link to the manual how to change (and get back the bold) for the input / ouput color.

@jayschwa
Copy link
Member Author

jayschwa commented Jan 7, 2017

Pushed an update that contains a NEWS entry for the style change.

Some hardcoded ANSI codes were also replaced with `text_colors`.
@jayschwa
Copy link
Member Author

jayschwa commented Jan 7, 2017

@KristofferC, I just updated the prompt and banner colors to use light variants. In the future, if bold is turned off on any of these things, their color will be unaffected. Dots in the banner are still bold, but I did unbold the ASCII art "julia" part since I think it looks better.

Are there any Windows builds that are automatically generated? I'm interested to see how light variants work there (but don't let that hold up the PR from being merged).

@KristofferC
Copy link
Member

Can't you just print some hard coded ANSI to see how it looks on windows? With everything else being not bold I don't see a reason for having the prompt bold but I don't mind that much.

@JeffBezanson
Copy link
Member

Non-bold green is pretty dark in some terminals.

@KristofferC
Copy link
Member

Yes but see discussion at #11250 (comment)

@jayschwa
Copy link
Member Author

jayschwa commented Jan 8, 2017

I just played with a nightly on Windows and convinced myself that light_[color] is working and equivalent to bold [color]. I think it's good to go.

With everything else being not bold I don't see a reason for having the prompt bold

This PR has been lingering for a year and a half. I'd rather not increase the scope 😄.

@KristofferC
Copy link
Member

Ok, I'll make that PR then ;)

@StefanKarpinski
Copy link
Member

What is the status of this? It seems to have stalled out again, although the only conflict is NEWS.md

@jayschwa
Copy link
Member Author

I resolved the conflict in NEWS, which was caused by all of the entries being wrapped to a different line length on master. I suggest using "Display the rich diff" when reviewing that file.

For example, one way of doing this is adding `ENV["JULIA_INPUT_COLOR"] = :bold` and `ENV["JULIA_ANSWER_COLOR"] = :bold` to the `.juliarc.jl` file.
See the [manual section on customizing colors](http://docs.julialang.org/en/latest/manual/interacting-with-julia/#customizing-colors) for more information.

* The default color for info messages has been changed from blue to cyan, and for warning messages from red to yellow.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should probably have its issue/pr reference added, it got lost at some point

@StefanKarpinski StefanKarpinski merged commit 001a164 into JuliaLang:master Jan 25, 2017
@jayschwa jayschwa deleted the the-goggles-do-nothing branch January 25, 2017 16:39
@musm
Copy link
Contributor

musm commented Apr 18, 2017

It looks like all the underscore light_ colors ended up breaking the julia repl color setup for me on 0.6 on the bash subsystem for windows.

E.g. on 0.5
image

E.g. on 0.6

image

Is it possible to remove the light_ prefix so that things work as before ? I imagine I will not be the only one experiencing this issue.

@KristofferC
Copy link
Member

Yes, that should work fine.

@musm
Copy link
Contributor

musm commented Apr 18, 2017

thanks @KristofferC mind submitting a PR or should I?

@KristofferC
Copy link
Member

Likely to happen faster if you do it.

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
Development

Successfully merging this pull request may close these issues.