Method: rich.palette.Palette.__rich__
Calls: 1, Exceptions: 0, Paths: 1Back
Path 1: 1 calls (1.0)
Table (1)
1def __rich__(self) -> "Table":
2 from rich.color import Color
3 from rich.style import Style
4 from rich.text import Text
5 from rich.table import Table
6
7 table = Table(
8 "index",
9 "RGB",
10 "Color",
11 title="Palette",
12 caption=f"{len(self._colors)} colors",
13 highlight=True,
14 caption_justify="right",
15 )
16 for index, color in enumerate(self._colors):
17 table.add_row(
18 str(index),
19 repr(color),
20 Text(" " * 16, style=Style(bgcolor=Color.from_rgb(*color))),
21 )
22 return table