Skip to content

Commit

Permalink
print input and answer color in bold if given an ENV color
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC committed Sep 14, 2016
1 parent 0cb7310 commit 2b73c89
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ New language features
Language changes
----------------

* The function `print_with_color` no longer prints text in bold by default. As a side effect this means that if you are using `JULIA_INPUT_COLOR` to change the input color it will no longer be bold.
* The function `print_with_color` no longer prints text in bold by default.

Breaking changes
----------------
Expand Down
10 changes: 6 additions & 4 deletions base/client.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const disable_text_style = AnyDict(

# Create a docstring with an automatically generated list
# of colors.
const possible_formatting_symbols = [:normal, :bold, :italics, :underline]
const possible_formatting_symbols = [:normal, :bold, :italics, :underline, :default]
available_text_colors = collect(keys(text_colors))
available_text_colors = cat(1,
sort(intersect(available_text_colors, possible_formatting_symbols), rev=true),
Expand All @@ -49,7 +49,7 @@ const available_text_colors_docstring =
Available colors are: $available_text_colors_docstring.
The color `:default` will print text in the default color while the color `:normal`
will print text with all properties reset to normal (including boldness, italics etc).
will print text with all properties reset to normal (including boldness, italics etc.).
"""
text_colors

Expand All @@ -72,8 +72,10 @@ end

warn_color() = repl_color("JULIA_WARN_COLOR", default_color_warn)
info_color() = repl_color("JULIA_INFO_COLOR", default_color_info)
input_color() = text_colors[repl_color("JULIA_INPUT_COLOR", default_color_input)]
answer_color() = text_colors[repl_color("JULIA_ANSWER_COLOR", default_color_answer)]

# Print input and answer in bold unless the user specifies :default in the ENV var.
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)]

function repl_cmd(cmd, out)
shell = shell_split(get(ENV,"JULIA_SHELL",get(ENV,"SHELL","/bin/sh")))
Expand Down
2 changes: 1 addition & 1 deletion doc/stdlib/io-network.rst
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ Text I/O
Print strings in a color specified as a symbol.

``color`` may take any of the values ``:underline``\ , ``:normal``\ , ``:italics``\ , ``:bold``\ , ``:black``\ , ``:blue``\ , ``:cyan``\ , ``:dark_gray``\ , ``:default``\ , ``:green``\ , ``:light_blue``\ , ``:light_cyan``\ , ``:light_green``\ , ``:light_magenta``\ , ``:light_red``\ , ``:light_yellow``\ , ``:magenta``\ , ``:red``\ , ``:white``\ , or ``:yellow``\ .
``color`` may take any of the values ``:underline``\ , ``:normal``\ , ``:italics``\ , ``:default``\ , ``:bold``\ , ``:black``\ , ``:blue``\ , ``:cyan``\ , ``:dark_gray``\ , ``:green``\ , ``:light_blue``\ , ``:light_cyan``\ , ``:light_green``\ , ``:light_magenta``\ , ``:light_red``\ , ``:light_yellow``\ , ``:magenta``\ , ``:red``\ , ``:white``\ , or ``:yellow``\ .

.. function:: info(msg...; prefix="INFO: ")

Expand Down

0 comments on commit 2b73c89

Please sign in to comment.