MCPcopy
hub / github.com/Textualize/rich / Style

Class Style

rich/style.py:40–759  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

38
39@rich_repr
40class 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",

Callers 15

test_strFunction · 0.90
test_ansi_codesFunction · 0.90
test_reprFunction · 0.90
test_eqFunction · 0.90
test_hashFunction · 0.90
test_emptyFunction · 0.90
test_boolFunction · 0.90
test_color_propertyFunction · 0.90
test_bgcolor_propertyFunction · 0.90
test_parseFunction · 0.90
test_link_idFunction · 0.90
test_get_html_styleFunction · 0.90

Calls 1

_BitClass · 0.85

Tested by 15

test_strFunction · 0.72
test_ansi_codesFunction · 0.72
test_reprFunction · 0.72
test_eqFunction · 0.72
test_hashFunction · 0.72
test_emptyFunction · 0.72
test_boolFunction · 0.72
test_color_propertyFunction · 0.72
test_bgcolor_propertyFunction · 0.72
test_parseFunction · 0.72
test_link_idFunction · 0.72
test_get_html_styleFunction · 0.72