Skip to content

Commit

Permalink
Stop using bold text for input and answers
Browse files Browse the repository at this point in the history
Some hardcoded ANSI codes were also replaced with `text_colors`.
  • Loading branch information
jayschwa committed Jan 7, 2017
1 parent f4ed16b commit 16d346e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 21 deletions.
6 changes: 2 additions & 4 deletions base/REPL.jl
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ terminal(r::LineEditREPL) = r.t

LineEditREPL(t::TextTerminal, envcolors = false) = LineEditREPL(t,
true,
julia_green,
Base.text_colors[:green],
Base.input_color(),
Base.answer_color(),
Base.text_colors[:red],
Expand Down Expand Up @@ -598,8 +598,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)))
Expand Down Expand Up @@ -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())
run_repl(stream::IO) = run_repl(StreamREPL(stream))

outstream(s::StreamREPL) = s.stream
Expand Down
14 changes: 4 additions & 10 deletions base/client.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
15 changes: 8 additions & 7 deletions base/version.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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[:bold] * c[:default] # julia
d1 = c[:bold] * c[:blue] # first dot
d2 = c[:bold] * c[:red] # second dot
d3 = c[:bold] * c[:green] # third dot
d4 = c[:bold] * c[: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.
Expand Down

0 comments on commit 16d346e

Please sign in to comment.