Table Reference¶
Bases: Gradient
A Rich table convenience constructor with gradient rendering.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
headers
|
str | Column
|
Optional Rich table headers or |
()
|
title
|
TextType | None
|
Optional title rendered above the table. |
None
|
caption
|
TextType | None
|
Optional caption rendered below the table. |
None
|
width
|
int | None
|
Optional explicit table width. |
None
|
min_width
|
int | None
|
Optional minimum table width. |
None
|
box
|
Box | None
|
Rich box style for table borders. |
HEAVY_HEAD
|
safe_box
|
bool | None
|
Whether to use safe box drawing characters. |
None
|
padding
|
PaddingDimensions
|
Padding for table cells. |
(0, 1)
|
collapse_padding
|
bool
|
Whether to collapse cell padding. |
False
|
pad_edge
|
bool
|
Whether to pad edge cells. |
True
|
expand
|
bool
|
Whether the table expands to fill available width. |
False
|
show_header
|
bool
|
Whether to show the header row. |
True
|
show_footer
|
bool
|
Whether to show the footer row. |
False
|
show_edge
|
bool
|
Whether to draw outer table edges. |
True
|
show_lines
|
bool
|
Whether to draw lines between rows. |
False
|
leading
|
int
|
Blank lines between rows. |
0
|
style
|
StyleType
|
Base table style. |
'none'
|
row_styles
|
Sequence[StyleType] | None
|
Optional alternating row styles. |
None
|
header_style
|
StyleType
|
Header style. |
'table.header'
|
footer_style
|
StyleType
|
Footer style. |
'table.footer'
|
border_style
|
StyleType | None
|
Optional border style. |
None
|
title_style
|
StyleType | None
|
Optional title style. |
None
|
caption_style
|
StyleType | None
|
Optional caption style. |
None
|
title_justify
|
AlignMethod
|
Title justification. |
'center'
|
caption_justify
|
AlignMethod
|
Caption justification. |
'center'
|
highlight
|
bool
|
Whether Rich should highlight cell contents. |
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
|
justify
|
AlignMethod
|
Horizontal alignment of the table in the gradient frame. |
'left'
|
vertical_justify
|
VerticalAlignMethod
|
Vertical alignment of the table in the gradient frame. |
'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/table.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | |
table
property
¶
Return the underlying Rich table.
__init__(*headers, title=None, caption=None, width=None, min_width=None, box=HEAVY_HEAD, safe_box=None, padding=(0, 1), collapse_padding=False, pad_edge=True, expand=False, show_header=True, show_footer=False, show_edge=True, show_lines=False, leading=0, style='none', row_styles=None, header_style='table.header', footer_style='table.footer', border_style=None, title_style=None, caption_style=None, title_justify='center', caption_justify='center', highlight=False, colors=None, bg_colors=None, rainbow=False, hues=5, repeat_scale=2.0, justify='left', vertical_justify='middle', console=None, highlight_words=None, highlight_regex=None)
¶
Initialize a gradient-enabled Rich table.