Reference
GarishPrint.ColorPreference
— TypeColorPreference
The color preference type.
GarishPrint.ColorPreference
— MethodColorPreference(;kw...)
See pprint
for available keyword configurations.
GarishPrint.GarishIO
— TypeGarishIO{IO_t <: IO} <: IO
GarishIO
contains the pretty printing preference and states.
Members
bland_io::IO_t
: the original io.indent::Int
: indentation size.compact::Bool
: whether the printing should be compact.displaysize::Tuple{Int, Int}
: the terminal displaysize.show_indent
: print the indentation hint or not.color
: color preference, eitherColorPreference
ornothing
for no color.state
: the state of the printer, seePrintState
.
GarishPrint.GarishIO
— MethodGarishIO(io::IO, garish_io::GarishIO; kw...)
Create a new similar GarishIO
with new bland IO object io
based on an existing garish io preference. The preference can be overloaded by kw
. See pprint
for the available keyword arguments.
GarishPrint.GarishIO
— MethodGarishIO(io::IO; kw...)
See pprint
for available keywords.
GarishPrint.PrintType
— Type@enum PrintType
PrintType
to tell lower level printing some useful context. Currently only supports Unknown
and StructField
.
GarishPrint.default_colors_256
— Methoddefault_colors_256()
The default color 256 theme.
GarishPrint.default_colors_ansi
— Methoddefault_colors_ansi()
The default ANSI color theme.
GarishPrint.pprint_list_like
— Functionpprint_list_like(io::GarishIO, list, opn='[', cls=']'; compact::Bool=io.compact)
Print a list-like object list
. A list-like object should support the iterable interface such as Base.iterate
and Base.length
. This is modified based on base/arrayshow.jl:show_vector
.
Arguments
io::GarishIO
: theGarishIO
object one wants to print to.list
: the list-like object.opn
: the openning marker, default is[
.cls
: the closing marker, default is]
.
Keyword Arguments
compact::Bool
: print the list within one line or not.
GarishPrint.pprint_struct
— Functionpprint_struct([io::IO=stdout], [mimetype], x; kw...)
Pretty print object x
that is a struct type (isstructtype
returns true
).
Keyword Arguments
See pprint
, they share the same keyword arguments.
GarishPrint.pprint_struct
— Methodpprint_struct(io, ::MIME"text/plain", @nospecialize(x))
Print x
as a struct type with mime type MIME"text/plain"
.
GarishPrint.print_indent
— Methodprint_indent(io::GarishIO)
Print an indentation. This should be only used under MIME"text/plain"
or equivalent.
GarishPrint.print_operator
— Methodprint_operator(io::GarishIO, op)
Print an operator, such as =
, +
, =>
etc. This should be only used under MIME"text/plain"
or equivalent.
GarishPrint.print_token
— Methodprint_token(f, io::GarishIO, type::Symbol, xs...)
Print xs
to a GarishIO
as given token type using f(io, xs...)
GarishPrint.print_token
— Methodprint_token(io::GarishIO, type::Symbol, xs...)
Print xs
to a GarishIO
as given token type. The token type should match the field name of ColorPreference
.
GarishPrint.supports_color256
— Methodsupports_color256()
Check if the terminal supports color 256.
GarishPrint.tty_has_color
— Methodtty_has_color()
Check if TTY supports color. This is mainly for lower Julia version like 1.0.
GarishPrint.within_nextlevel
— Methodwithin_nextlevel(f, io::GarishIO)
Run f()
within the next level of indentation where f
is a function that print into io
.