Skip to content

Commit 97e65d3

Browse files
mcabbottKristofferC
authored andcommitted
Add compat note for printstyled (#42547)
(cherry picked from commit f2080d5)
1 parent 0d79b95 commit 97e65d3

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

base/strings/io.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ avoid Julia-specific details.
1515
For example, `show` displays strings with quotes, and `print` displays strings
1616
without quotes.
1717
18-
[`string`](@ref) returns the output of `print` as a string.
18+
See also [`println`](@ref), [`string`](@ref), [`printstyled`](@ref).
1919
2020
# Examples
2121
```jldoctest
@@ -57,6 +57,8 @@ end
5757
Print (using [`print`](@ref)) `xs` followed by a newline.
5858
If `io` is not supplied, prints to [`stdout`](@ref).
5959
60+
See also [`printstyled`](@ref) to add colors etc.
61+
6062
# Examples
6163
```jldoctest
6264
julia> println("Hello, world")

base/util.jl

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,18 @@ end
113113
114114
Print `xs` in a color specified as a symbol or integer, optionally in bold.
115115
116-
`color` may take any of the values $(Base.available_text_colors_docstring)
116+
Keyword `color` may take any of the values $(Base.available_text_colors_docstring)
117117
or an integer between 0 and 255 inclusive. Note that not all terminals support 256 colors.
118-
If the keyword `bold` is given as `true`, the result will be printed in bold.
119-
If the keyword `underline` is given as `true`, the result will be printed underlined.
120-
If the keyword `blink` is given as `true`, the result will blink.
121-
If the keyword `reverse` is given as `true`, the result will have foreground and background colors inversed.
122-
If the keyword `hidden` is given as `true`, the result will be hidden.
123-
Keywords can be given in any combination.
118+
119+
Keywords `bold=true`, `underline=true`, `blink=true` are self-explanatory.
120+
Keyword `reverse=true` prints with foreground and background colors exchanged,
121+
and `hidden=true` should be invisibe in the terminal but can still be copied.
122+
These properties can be used in any combination.
123+
124+
See also [`print`](@ref), [`println`](@ref), [`show`](@ref).
125+
126+
!!! compat "Julia 1.7"
127+
Keywords except `color` and `bold` were added in Julia 1.7.
124128
"""
125129
printstyled(io::IO, msg...; bold::Bool=false, underline::Bool=false, blink::Bool=false, reverse::Bool=false, hidden::Bool=false, color::Union{Int,Symbol}=:normal) =
126130
with_output_color(print, color, io, msg...; bold=bold, underline=underline, blink=blink, reverse=reverse, hidden=hidden)

0 commit comments

Comments
 (0)