Pretty Reference¶
Bases: Gradient
A Rich pretty-printer convenience constructor with gradient rendering.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
object_
|
Any
|
Object to pretty print. |
required |
highlighter
|
Highlighter | None
|
Optional Rich highlighter. |
None
|
indent_size
|
int
|
Number of spaces per indent. |
4
|
pretty_justify
|
JustifyMethod | None
|
Justification used by Rich Pretty. |
None
|
overflow
|
OverflowMethod | None
|
Overflow handling used by Rich Pretty. |
None
|
no_wrap
|
bool | None
|
Whether to disable wrapping. |
False
|
indent_guides
|
bool
|
Whether to show indentation guides. |
False
|
max_length
|
int | None
|
Maximum container length before abbreviation. |
None
|
max_string
|
int | None
|
Maximum string length before truncation. |
None
|
max_depth
|
int | None
|
Maximum nested depth. |
None
|
expand_all
|
bool
|
Whether to expand all containers. |
False
|
margin
|
int
|
Width margin for expansion. |
0
|
insert_line
|
bool
|
Whether to insert a line before multiline output. |
False
|
colors
|
Optional[Sequence[ColorType]]
|
Foreground gradient color stops. |
None
|
bg_colors
|
Optional[Sequence[ColorType]]
|
Background gradient color stops. |
None
|
rainbow
|
bool
|
Whether to generate a rainbow palette. |
False
|
hues
|
int
|
Number of auto-generated hues. |
5
|
repeat_scale
|
float
|
Scale factor controlling gradient repeats. |
2.0
|
expand
|
bool
|
Whether the gradient frame expands. |
True
|
justify
|
AlignMethod
|
Horizontal alignment. |
'left'
|
vertical_justify
|
VerticalAlignMethod
|
Vertical alignment. |
'middle'
|
console
|
Optional[Console]
|
Optional Rich console. |
None
|
highlight_words
|
Optional[HighlightWordsType]
|
Word highlight configuration. |
None
|
highlight_regex
|
Optional[HighlightRegexType]
|
Regex highlight configuration. |
None
|
Source code in src/rich_gradient/pretty.py
pretty
property
¶
Return the underlying Rich Pretty renderable.
__init__(object_, *, highlighter=None, indent_size=4, pretty_justify=None, overflow=None, no_wrap=False, indent_guides=False, max_length=None, max_string=None, max_depth=None, expand_all=False, margin=0, insert_line=False, colors=None, bg_colors=None, rainbow=False, hues=5, repeat_scale=2.0, expand=True, justify='left', vertical_justify='middle', console=None, highlight_words=None, highlight_regex=None)
¶
Initialize a gradient-enabled Rich pretty-printer.