A terminal style. A terminal style consists of a color (`color`), a background color (`bgcolor`), and a number of attributes, such as bold, italic etc. The attributes have 3 states: they can either be on (``True``), off (``False``), or not set (``None``). Args: color (Union
| 38 | |
| 39 | @rich_repr |
| 40 | class Style: |
| 41 | """A terminal style. |
| 42 | |
| 43 | A terminal style consists of a color (`color`), a background color (`bgcolor`), and a number of attributes, such |
| 44 | as bold, italic etc. The attributes have 3 states: they can either be on |
| 45 | (``True``), off (``False``), or not set (``None``). |
| 46 | |
| 47 | Args: |
| 48 | color (Union[Color, str], optional): Color of terminal text. Defaults to None. |
| 49 | bgcolor (Union[Color, str], optional): Color of terminal background. Defaults to None. |
| 50 | bold (bool, optional): Enable bold text. Defaults to None. |
| 51 | dim (bool, optional): Enable dim text. Defaults to None. |
| 52 | italic (bool, optional): Enable italic text. Defaults to None. |
| 53 | underline (bool, optional): Enable underlined text. Defaults to None. |
| 54 | blink (bool, optional): Enabled blinking text. Defaults to None. |
| 55 | blink2 (bool, optional): Enable fast blinking text. Defaults to None. |
| 56 | reverse (bool, optional): Enabled reverse text. Defaults to None. |
| 57 | conceal (bool, optional): Enable concealed text. Defaults to None. |
| 58 | strike (bool, optional): Enable strikethrough text. Defaults to None. |
| 59 | underline2 (bool, optional): Enable doubly underlined text. Defaults to None. |
| 60 | frame (bool, optional): Enable framed text. Defaults to None. |
| 61 | encircle (bool, optional): Enable encircled text. Defaults to None. |
| 62 | overline (bool, optional): Enable overlined text. Defaults to None. |
| 63 | link (str, link): Link URL. Defaults to None. |
| 64 | |
| 65 | """ |
| 66 | |
| 67 | _color: Optional[Color] |
| 68 | _bgcolor: Optional[Color] |
| 69 | _attributes: int |
| 70 | _set_attributes: int |
| 71 | _hash: Optional[int] |
| 72 | _null: bool |
| 73 | _meta: Optional[bytes] |
| 74 | |
| 75 | __slots__ = [ |
| 76 | "_color", |
| 77 | "_bgcolor", |
| 78 | "_attributes", |
| 79 | "_set_attributes", |
| 80 | "_link", |
| 81 | "_link_id", |
| 82 | "_ansi", |
| 83 | "_style_definition", |
| 84 | "_hash", |
| 85 | "_null", |
| 86 | "_meta", |
| 87 | ] |
| 88 | |
| 89 | # maps bits on to SGR parameter |
| 90 | _style_map = { |
| 91 | 0: "1", |
| 92 | 1: "2", |
| 93 | 2: "3", |
| 94 | 3: "4", |
| 95 | 4: "5", |
| 96 | 5: "6", |
| 97 | 6: "7", |