Displays the actual color if Rich printed.
(self)
| 313 | """A triplet of color components, if an RGB color.""" |
| 314 | |
| 315 | def __rich__(self) -> "Text": |
| 316 | """Displays the actual color if Rich printed.""" |
| 317 | from .style import Style |
| 318 | from .text import Text |
| 319 | |
| 320 | return Text.assemble( |
| 321 | f"<color {self.name!r} ({self.type.name.lower()})", |
| 322 | ("⬤", Style(color=self)), |
| 323 | " >", |
| 324 | ) |
| 325 | |
| 326 | def __rich_repr__(self) -> Result: |
| 327 | yield self.name |