Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions src/io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,8 @@ end
Base.AnnotatedDisplay.show_annot(io::IO, ::MIME"text/html", s::Union{<:AnnotatedString, SubString{<:AnnotatedString}}) =
show_html(io, s)

# Also see `legacy.jl:126` for `styled_write`.

# End AnnotatedDisplay hooks
# ------------

Expand Down
15 changes: 7 additions & 8 deletions src/legacy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,14 @@ function load_env_colors!()
end
end

function Base.printstyled(io::AnnotatedIOBuffer, msg...;
bold::Bool=false, italic::Bool=false, underline::Bool=false,
blink::Bool=false, reverse::Bool=false, hidden::Bool=false,
color::Union{Symbol, Int}=:normal)
# Part of the inference barrier around `Base.printstyled`
function Base.AnnotatedDisplay.styled_print(io::AnnotatedIOBuffer, @nospecialize(msg::Tuple), @nospecialize(kwargs::Base.Pairs))
str = annotatedstring(msg...)
bold && face!(str, :bold)
italic && face!(str, :italic)
underline && face!(str, :underline)
reverse && face!(str, :inverse)
for attr in (:bold, :italic, :underline)
get(kwargs, attr, false)::Bool && face!(str, attr)
end
get(kwargs, :reverse, false)::Bool && face!(str, :inverse)
color = get(kwargs, :color, :normal)::Symbol
color !== :normal && face!(str, Face(foreground=legacy_color(color)))
write(io, str)
nothing
Expand Down
Loading