using Printf
struct Foo
val
end
function Base.show(io::IO, x::Foo)
print(io, "Foo=")
printstyled(io,x.val; color=:yellow)
end
julia>string(Foo(10))
"Foo=10"
And I tired to replace printstyled with Crayons
using Crayons
struct Foo
val
end
function Base.show(io::IO, x::Foo)
print(io, "Foo=", Crayon(forecround=:yellow), x.val)
end
julia>string(Foo(10))
"Foo=\e[33m10"
Is there way for me to make string conversion work as before? without overriding the string method
This was what I've been doing
And I tired to replace
printstyled
with CrayonsIs there way for me to make
string
conversion work as before? without overriding thestring
method