# \[ANN\] GarishPrint.jl - (Yet another) Pretty Printing your own julia objects!

**URL:** <https://discourse.julialang.org/t/ann-garishprint-jl-yet-another-pretty-printing-your-own-julia-objects/63340>\
**Category:** Package Announcements\
**Tags:** announcement\
**Created:** [June 21, 2021, 11:41pm UTC](https://discourse.julialang.org/t/ann-garishprint-jl-yet-another-pretty-printing-your-own-julia-objects/63340 "2021-06-21T23:41:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roger-luo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/roger-luo/32/3399_2.png) [@Roger-luo](https://discourse.julialang.org/u/Roger-luo)\
**Post date:** [June 21, 2021, 11:41pm UTC](https://discourse.julialang.org/t/ann-garishprint-jl-yet-another-pretty-printing-your-own-julia-objects/63340/1 "2021-06-21T23:41:15Z")

</div>

I’m excited to announce a new package to make the types defined by your own easily colorful and structural, despite of the implementation itself, this package is extremely easy to use, you only need to replace your `print` function with `pprint` function exported by this package, and that’s it.

> **[GitHub - Roger-luo/GarishPrint.jl: An opinioned pretty printing package for...](https://github.com/Roger-luo/GarishPrint.jl)**
>
> An opinioned pretty printing package for Julia objects. - GitHub - Roger-luo/GarishPrint.jl: An opinioned pretty printing package for Julia objects.

This functionality was originally inside [Configurations](https://github.com/Roger-luo/Configurations.jl) with some ugly hacks, I rewrite the whole printing mechanism to make things better and easier to read.

There have been two other pretty printing packages in Julia which is [PrettyPrint](https://discourse.julialang.org/t/ann-prettyprint-jl-handy-and-extensible-pretty-print-also-simple/23591)  
and [PrettyPrinting](https://discourse.julialang.org/t/ann-prettyprinting-jl/21109), but before I start talking about the boring implementation details, let’s have a fight!

TL;DR

just check this example

```julia
struct ABC{T1, T2, T3}
    hee::T1
    haa::T2
    hoo::T3
end

struct Example{T1, T2}
    field_a::T1
    field_b::T2
    abc::ABC
end

x = Example(
    Dict(
        "a"=>Example(
            [1, 2, 3],
            2.0,
            ABC(1, 2.0im, 3.12f0),
        ),
        "str" => Set([1, 2, 3]),
        "boolean"=> false,
        "missing" => missing,
        "empty set" => Set(),
        "set" => Set([1, 2, 3]),
        "set{any}" => Set(Any[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]),
        "type" => Any,
        "nested" => Example(
            Dict(
                "a"=>Example(
                    [1, 2, 3],
                    2.0,
                    ABC(1, 2.0im, 3.12f0),
                ),
            ),
            undef,
            ABC(nothing, 1.2+2.1im, π),
        )
    ),
    undef,
    ABC(nothing, 1.2+2.1im, π),
)

```

 ![image](https://global.discourse-cdn.com/julialang/original/3X/6/1/610dbfc61e130206df795982f7cc58180c20a423.jpeg)

 ![image](https://global.discourse-cdn.com/julialang/original/3X/3/7/37c0d2fc4152344b87a802681c70e35985ff83d7.jpeg)

 ![image](https://global.discourse-cdn.com/julialang/original/3X/9/5/95c667e69b9aeebca9565b0a6a618fe693a04947.png)

The previous efforts both use some smarter way of handling formats, where GarishPrint’s implementation is kinda “dumb”: it only revise Julia’s own `Base.show` infrastructure with structural printing and colors and depends on some Julia internal printing infrastructure (well that’s the price I have to pay), but it makes things work more consistent with Julia itself.

What’s more?! I’m planning to move the HTML printing from Configurations to this package, and `GarishPrint.pprint` already supports custom mime type and integrate it with Pluto of course! Stay tuned!

---

<div class="post-metadata">

**Author:** ![Roger-luo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/roger-luo/32/3399_2.png) [@Roger-luo](https://discourse.julialang.org/u/Roger-luo)\
**Post date:** [June 21, 2021, 11:44pm UTC](https://discourse.julialang.org/t/ann-garishprint-jl-yet-another-pretty-printing-your-own-julia-objects/63340/2 "2021-06-21T23:44:21Z")

</div>

Oh and I wanted to integrate this package with Preference so that you can tune your own favorite color, but I need to wait for the next Julia patch due to this: [fix preference loading for non string value by Roger-luo · Pull Request #41294 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/pull/41294) so for those who deosn’t like my default color schema, wait for the next julia release!
