Skip to content
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
16 changes: 15 additions & 1 deletion src/legacy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

module Legacy

using ..StyledStrings: SimpleColor, Face, loadface!
using ..StyledStrings: SimpleColor, Face, loadface!, face!

"""
A mapping from 256-color codes indicies to 8-bit colours.
Expand Down Expand Up @@ -112,4 +112,18 @@ function load_env_colors!()
end
end

function Base.printstyled(io::Base.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)
str = Base.annotatedstring(msg...)
bold && face!(str, :bold)
italic && face!(str, :italic)
underline && face!(str, :underline)
reverse && face!(str, Face(inverse=true))
color !== :normal && face!(str, Face(foreground=legacy_color(color)))
write(io, str)
nothing
end

end