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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 20 additions & 26 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -151,32 +151,25 @@ Library improvements
without having to scrub away prompts and outputs.
This can be disabled or enabled at will with `Base.REPL.enable_promptpaste(::Bool)`.

* The function `print_with_color` can now take a color represented by an
integer between 0 and 255 inclusive as its first argument ([#18473]). For
a number to color mapping please refer to [this
chart](https://commons.wikimedia.org/wiki/File:Xterm_256color_chart.svg).
It is also possible to use numbers as colors in environment variables that
customizes colors in the REPL. For example, to get orange warning
messages, simply set `ENV["JULIA_WARN_COLOR"] = 208`. Please note that not
all terminals support 256 colors.

* The function `print_with_color` no longer prints text in bold by default
([#18628]). Instead, the function now take a keyword argument `bold::Bool`
which determines whether to print in bold or not. On some terminals,
printing a color in non bold results in slightly darker colors being
printed than when printing in bold. Therefore, light versions of the
colors are now supported. For the available colors see the help entry on
`print_with_color`.

* The default color for info messages has been changed from blue to cyan and
for warning messages from red to yellow. This can be changed back to the
original colors by setting the environment variables `JULIA_INFO_COLOR` to
`"blue"` and `JULIA_WARN_COLOR` to `"red"`. One way of doing this is by
adding for example `ENV["JULIA_INFO_COLOR"] = :blue` and
`ENV["JULIA_WARN_COLOR"] = :red` to the `.juliarc.jl` file. For more
information regarding customizing colors in the REPL, see this [manual
section](
http://docs.julialang.org/en/latest/manual/interacting-with-julia/#customizing-colors).
* The function `print_with_color` can now take a color represented by an integer between 0 and 255 inclusive as its first argument ([#18473]).
For a number to color mapping please refer to [this chart](https://upload.wikimedia.org/wikipedia/en/1/15/Xterm_256color_chart.svg).
It is also possible to use numbers as colors in environment variables that customizes colors in the REPL.
For example, to get orange warning messages, simply set `ENV["JULIA_WARN_COLOR"] = 208`.
Please note that not all terminals support 256 colors.

* The function `print_with_color` no longer prints text in bold by default ([#18628]).
Instead, the function now take a keyword argument `bold::Bool` which determines whether to print in bold or not.
On some terminals, printing a color in non bold results in slightly darker colors being printed than when printing in bold.
Therefore, light versions of the colors are now supported.
For the available colors see the help entry on `print_with_color`.

* The default text style for REPL input and answers has been changed from bold to normal ([#11250]).
They can be changed back to bold by setting the environment variables `JULIA_INPUT_COLOR` and `JULIA_ANSWER_COLOR` to `"bold"`.
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

This can be changed back to the original colors by setting the environment variables `JULIA_INFO_COLOR` to `"blue"` and `JULIA_WARN_COLOR` to `"red"`.

* Iteration utilities that wrap iterators and return other iterators (`enumerate`, `zip`, `rest`,
`countfrom`, `take`, `drop`, `cycle`, `repeated`, `product`, `flatten`, `partition`) have been
@@ -768,6 +761,7 @@ Language tooling improvements
[#10548]: https://github.com/JuliaLang/julia/issues/10548
[#11196]: https://github.com/JuliaLang/julia/issues/11196
[#11242]: https://github.com/JuliaLang/julia/issues/11242
[#11250]: https://github.com/JuliaLang/julia/issues/11250
[#11688]: https://github.com/JuliaLang/julia/issues/11688
[#12231]: https://github.com/JuliaLang/julia/issues/12231
[#12563]: https://github.com/JuliaLang/julia/issues/12563
6 changes: 2 additions & 4 deletions base/REPL.jl
Original file line number Diff line number Diff line change
@@ -268,7 +268,7 @@ terminal(r::LineEditREPL) = r.t

LineEditREPL(t::TextTerminal, envcolors = false) = LineEditREPL(t,
true,
julia_green,
Base.text_colors[:light_green],
Base.input_color(),
Base.answer_color(),
Base.text_colors[:red],
@@ -599,8 +599,6 @@ function history_reset_state(hist::REPLHistoryProvider)
end
LineEdit.reset_state(hist::REPLHistoryProvider) = history_reset_state(hist)

const julia_green = "\033[1m\033[32m"

function return_callback(s)
ast = Base.syntax_deprecation_warnings(false) do
Base.parse_input_line(String(LineEdit.buffer(s)))
@@ -959,7 +957,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_colors[:light_green], Base.input_color(), Base.answer_color())
run_repl(stream::IO) = run_repl(StreamREPL(stream))

outstream(s::StreamREPL) = s.stream
14 changes: 4 additions & 10 deletions base/client.jl
Original file line number Diff line number Diff line change
@@ -61,13 +61,8 @@ have_color = false
default_color_warn = :yellow
default_color_error = :light_red
default_color_info = :cyan
if is_windows()
default_color_input = :normal
default_color_answer = :normal
else
default_color_input = :bold
default_color_answer = :bold
end
default_color_input = :normal
default_color_answer = :normal
color_normal = text_colors[:normal]

function repl_color(key, default)
@@ -81,9 +76,8 @@ error_color() = repl_color("JULIA_ERROR_COLOR", default_color_error)
warn_color() = repl_color("JULIA_WARN_COLOR" , default_color_warn)
info_color() = repl_color("JULIA_INFO_COLOR" , default_color_info)

# Print input and answer in bold.
input_color() = text_colors[:bold] * text_colors[repl_color("JULIA_INPUT_COLOR", default_color_input)]
answer_color() = text_colors[:bold] * text_colors[repl_color("JULIA_ANSWER_COLOR", default_color_answer)]
input_color() = text_colors[repl_color("JULIA_INPUT_COLOR", default_color_input)]
answer_color() = text_colors[repl_color("JULIA_ANSWER_COLOR", default_color_answer)]

stackframe_lineinfo_color() = repl_color("JULIA_STACKFRAME_LINEINFO_COLOR", :bold)
stackframe_function_color() = repl_color("JULIA_STACKFRAME_FUNCTION_COLOR", :bold)
17 changes: 9 additions & 8 deletions base/version.jl
Original file line number Diff line number Diff line change
@@ -245,14 +245,15 @@ function banner(io::IO = STDOUT)
commit_date = GIT_VERSION_INFO.date_string != "" ? " ($(GIT_VERSION_INFO.date_string))": ""

if have_color
tx = "\033[0m\033[1m" # text
jl = "\033[0m\033[1m" # julia
d1 = "\033[34m" # first dot
d2 = "\033[31m" # second dot
d3 = "\033[32m" # third dot
d4 = "\033[35m" # fourth dot
c = text_colors
tx = c[:normal] # text
jl = c[:normal] # julia
d1 = c[:bold] * c[:light_blue] # first dot
d2 = c[:bold] * c[:light_red] # second dot
d3 = c[:bold] * c[:light_green] # third dot
d4 = c[:bold] * c[:light_magenta] # fourth dot

print(io,"""\033[1m $(d3)_$(tx)
print(io,""" $(d3)_$(tx)
$(d1)_$(tx) $(jl)_$(tx) $(d2)_$(d3)(_)$(d4)_$(tx) | A fresh approach to technical computing
$(d1)(_)$(jl) | $(d2)(_)$(tx) $(d4)(_)$(tx) | Documentation: http://docs.julialang.org
$(jl)_ _ _| |_ __ _$(tx) | Type \"?help\" for help.
@@ -261,7 +262,7 @@ function banner(io::IO = STDOUT)
$(jl)_/ |\\__'_|_|_|\\__'_|$(tx) | $(commit_string)
$(jl)|__/$(tx) | $(Sys.MACHINE)

\033[0m""")
""")
else
print(io,"""
_