Method: rich.style.Style._make_ansi_codes
Calls: 464, Exceptions: 0, Paths: 25Back
Path 1: 302 calls (0.65)
ColorSystem (302)
'39;49' (4) '38;2;0;0;0;48;2;248;248;248' (2) '91;48;5;94' (2) '38;2;255;0;0;48;5;200' (1) '38;5;200;48;2;255;0;0' (1) '38;2;86;0;0;48;2;51;0;0' (1) '...
1def _make_ansi_codes(self, color_system: ColorSystem) -> str:
2 """Generate ANSI codes for this style.
3
4 Args:
5 color_system (ColorSystem): Color system.
6
7 Returns:
8 str: String containing codes.
9 """
10
11 if self._ansi is None:
12 sgr: List[str] = []
13 append = sgr.append
14 _style_map = self._style_map
15 attributes = self._attributes & self._set_attributes
16 if attributes:
17 if attributes & 1:
18 append(_style_map[0])
19 if attributes & 2:
20 append(_style_map[1])
21 if attributes & 4:
22 append(_style_map[2])
23 if attributes & 8:
24 append(_style_map[3])
25 if attributes & 0b0000111110000:
26 for bit in range(4, 9):
27 if attributes & (1 << bit):
28 append(_style_map[bit])
29 if attributes & 0b1111000000000:
30 for bit in range(9, 13):
31 if attributes & (1 << bit):
32 append(_style_map[bit])
33 if self._color is not None:
34 sgr.extend(self._color.downgrade(color_system).get_ansi_codes())
35 if self._bgcolor is not None:
36 sgr.extend(
37 self._bgcolor.downgrade(color_system).get_ansi_codes(
38 foreground=False
39 )
40 )
41 self._ansi = ";".join(sgr)
42 return self._ansi
Path 2: 63 calls (0.14)
ColorSystem (63)
'38;2;244;38;112' (6) '38;2;230;39;108' (6) '38;2;209;42;102' (6) '38;2;183;44;94' (6) '38;2;249;38;114' (4) '38;2;153;48;86' (4) '32' (3) '33' (3) '3...
1def _make_ansi_codes(self, color_system: ColorSystem) -> str:
2 """Generate ANSI codes for this style.
3
4 Args:
5 color_system (ColorSystem): Color system.
6
7 Returns:
8 str: String containing codes.
9 """
10
11 if self._ansi is None:
12 sgr: List[str] = []
13 append = sgr.append
14 _style_map = self._style_map
15 attributes = self._attributes & self._set_attributes
16 if attributes:
17 if attributes & 1:
18 append(_style_map[0])
19 if attributes & 2:
20 append(_style_map[1])
21 if attributes & 4:
22 append(_style_map[2])
23 if attributes & 8:
24 append(_style_map[3])
25 if attributes & 0b0000111110000:
26 for bit in range(4, 9):
27 if attributes & (1 << bit):
28 append(_style_map[bit])
29 if attributes & 0b1111000000000:
30 for bit in range(9, 13):
31 if attributes & (1 << bit):
32 append(_style_map[bit])
33 if self._color is not None:
34 sgr.extend(self._color.downgrade(color_system).get_ansi_codes())
35 if self._bgcolor is not None:
36 sgr.extend(
37 self._bgcolor.downgrade(color_system).get_ansi_codes(
38 foreground=False
39 )
40 )
41 self._ansi = ";".join(sgr)
42 return self._ansi
Path 3: 23 calls (0.05)
ColorSystem (23)
'1;35' (4) '1;33' (4) '1;36' (4) '1;32' (3) '1;34' (3) '1;31' (2) '1;95' (1) '1;92' (1) '1;91' (1)
1def _make_ansi_codes(self, color_system: ColorSystem) -> str:
2 """Generate ANSI codes for this style.
3
4 Args:
5 color_system (ColorSystem): Color system.
6
7 Returns:
8 str: String containing codes.
9 """
10
11 if self._ansi is None:
12 sgr: List[str] = []
13 append = sgr.append
14 _style_map = self._style_map
15 attributes = self._attributes & self._set_attributes
16 if attributes:
17 if attributes & 1:
18 append(_style_map[0])
19 if attributes & 2:
20 append(_style_map[1])
21 if attributes & 4:
22 append(_style_map[2])
23 if attributes & 8:
24 append(_style_map[3])
25 if attributes & 0b0000111110000:
26 for bit in range(4, 9):
27 if attributes & (1 << bit):
28 append(_style_map[bit])
29 if attributes & 0b1111000000000:
30 for bit in range(9, 13):
31 if attributes & (1 << bit):
32 append(_style_map[bit])
33 if self._color is not None:
34 sgr.extend(self._color.downgrade(color_system).get_ansi_codes())
35 if self._bgcolor is not None:
36 sgr.extend(
37 self._bgcolor.downgrade(color_system).get_ansi_codes(
38 foreground=False
39 )
40 )
41 self._ansi = ";".join(sgr)
42 return self._ansi
Path 4: 15 calls (0.03)
ColorSystem (15)
'2' (15)
1def _make_ansi_codes(self, color_system: ColorSystem) -> str:
2 """Generate ANSI codes for this style.
3
4 Args:
5 color_system (ColorSystem): Color system.
6
7 Returns:
8 str: String containing codes.
9 """
10
11 if self._ansi is None:
12 sgr: List[str] = []
13 append = sgr.append
14 _style_map = self._style_map
15 attributes = self._attributes & self._set_attributes
16 if attributes:
17 if attributes & 1:
18 append(_style_map[0])
19 if attributes & 2:
20 append(_style_map[1])
21 if attributes & 4:
22 append(_style_map[2])
23 if attributes & 8:
24 append(_style_map[3])
25 if attributes & 0b0000111110000:
26 for bit in range(4, 9):
27 if attributes & (1 << bit):
28 append(_style_map[bit])
29 if attributes & 0b1111000000000:
30 for bit in range(9, 13):
31 if attributes & (1 << bit):
32 append(_style_map[bit])
33 if self._color is not None:
34 sgr.extend(self._color.downgrade(color_system).get_ansi_codes())
35 if self._bgcolor is not None:
36 sgr.extend(
37 self._bgcolor.downgrade(color_system).get_ansi_codes(
38 foreground=False
39 )
40 )
41 self._ansi = ";".join(sgr)
42 return self._ansi
Path 5: 12 calls (0.03)
ColorSystem (12)
'1;38;2;0;0;255;48;2;248;248;248' (2) '1;38;2;227;227;221;48;2;39;40;34' (1) '1;38;2;170;34;255;48;2;248;248;248' (1) '1;31;40' (1) '1;38;2;24;24;24;4...
1def _make_ansi_codes(self, color_system: ColorSystem) -> str:
2 """Generate ANSI codes for this style.
3
4 Args:
5 color_system (ColorSystem): Color system.
6
7 Returns:
8 str: String containing codes.
9 """
10
11 if self._ansi is None:
12 sgr: List[str] = []
13 append = sgr.append
14 _style_map = self._style_map
15 attributes = self._attributes & self._set_attributes
16 if attributes:
17 if attributes & 1:
18 append(_style_map[0])
19 if attributes & 2:
20 append(_style_map[1])
21 if attributes & 4:
22 append(_style_map[2])
23 if attributes & 8:
24 append(_style_map[3])
25 if attributes & 0b0000111110000:
26 for bit in range(4, 9):
27 if attributes & (1 << bit):
28 append(_style_map[bit])
29 if attributes & 0b1111000000000:
30 for bit in range(9, 13):
31 if attributes & (1 << bit):
32 append(_style_map[bit])
33 if self._color is not None:
34 sgr.extend(self._color.downgrade(color_system).get_ansi_codes())
35 if self._bgcolor is not None:
36 sgr.extend(
37 self._bgcolor.downgrade(color_system).get_ansi_codes(
38 foreground=False
39 )
40 )
41 self._ansi = ";".join(sgr)
42 return self._ansi
Path 6: 10 calls (0.02)
ColorSystem (10)
'48;2;39;40;34' (3) '44' (2) '48;5;94' (2) '42' (1) '41' (1) '48;2;248;248;248' (1)
1def _make_ansi_codes(self, color_system: ColorSystem) -> str:
2 """Generate ANSI codes for this style.
3
4 Args:
5 color_system (ColorSystem): Color system.
6
7 Returns:
8 str: String containing codes.
9 """
10
11 if self._ansi is None:
12 sgr: List[str] = []
13 append = sgr.append
14 _style_map = self._style_map
15 attributes = self._attributes & self._set_attributes
16 if attributes:
17 if attributes & 1:
18 append(_style_map[0])
19 if attributes & 2:
20 append(_style_map[1])
21 if attributes & 4:
22 append(_style_map[2])
23 if attributes & 8:
24 append(_style_map[3])
25 if attributes & 0b0000111110000:
26 for bit in range(4, 9):
27 if attributes & (1 << bit):
28 append(_style_map[bit])
29 if attributes & 0b1111000000000:
30 for bit in range(9, 13):
31 if attributes & (1 << bit):
32 append(_style_map[bit])
33 if self._color is not None:
34 sgr.extend(self._color.downgrade(color_system).get_ansi_codes())
35 if self._bgcolor is not None:
36 sgr.extend(
37 self._bgcolor.downgrade(color_system).get_ansi_codes(
38 foreground=False
39 )
40 )
41 self._ansi = ";".join(sgr)
42 return self._ansi
Path 7: 7 calls (0.02)
ColorSystem (7)
'2;32' (2) '2;34' (1) '2;36' (1) '2;35' (1) '2;38;2;123;234;123' (1) '2;33' (1)
1def _make_ansi_codes(self, color_system: ColorSystem) -> str:
2 """Generate ANSI codes for this style.
3
4 Args:
5 color_system (ColorSystem): Color system.
6
7 Returns:
8 str: String containing codes.
9 """
10
11 if self._ansi is None:
12 sgr: List[str] = []
13 append = sgr.append
14 _style_map = self._style_map
15 attributes = self._attributes & self._set_attributes
16 if attributes:
17 if attributes & 1:
18 append(_style_map[0])
19 if attributes & 2:
20 append(_style_map[1])
21 if attributes & 4:
22 append(_style_map[2])
23 if attributes & 8:
24 append(_style_map[3])
25 if attributes & 0b0000111110000:
26 for bit in range(4, 9):
27 if attributes & (1 << bit):
28 append(_style_map[bit])
29 if attributes & 0b1111000000000:
30 for bit in range(9, 13):
31 if attributes & (1 << bit):
32 append(_style_map[bit])
33 if self._color is not None:
34 sgr.extend(self._color.downgrade(color_system).get_ansi_codes())
35 if self._bgcolor is not None:
36 sgr.extend(
37 self._bgcolor.downgrade(color_system).get_ansi_codes(
38 foreground=False
39 )
40 )
41 self._ansi = ";".join(sgr)
42 return self._ansi
Path 8: 5 calls (0.01)
ColorSystem (5)
'3;91' (1) '3;92' (1) '3;35' (1) '3;34' (1) '3;33' (1)
1def _make_ansi_codes(self, color_system: ColorSystem) -> str:
2 """Generate ANSI codes for this style.
3
4 Args:
5 color_system (ColorSystem): Color system.
6
7 Returns:
8 str: String containing codes.
9 """
10
11 if self._ansi is None:
12 sgr: List[str] = []
13 append = sgr.append
14 _style_map = self._style_map
15 attributes = self._attributes & self._set_attributes
16 if attributes:
17 if attributes & 1:
18 append(_style_map[0])
19 if attributes & 2:
20 append(_style_map[1])
21 if attributes & 4:
22 append(_style_map[2])
23 if attributes & 8:
24 append(_style_map[3])
25 if attributes & 0b0000111110000:
26 for bit in range(4, 9):
27 if attributes & (1 << bit):
28 append(_style_map[bit])
29 if attributes & 0b1111000000000:
30 for bit in range(9, 13):
31 if attributes & (1 << bit):
32 append(_style_map[bit])
33 if self._color is not None:
34 sgr.extend(self._color.downgrade(color_system).get_ansi_codes())
35 if self._bgcolor is not None:
36 sgr.extend(
37 self._bgcolor.downgrade(color_system).get_ansi_codes(
38 foreground=False
39 )
40 )
41 self._ansi = ";".join(sgr)
42 return self._ansi
Path 9: 3 calls (0.01)
ColorSystem (3)
'1' (3)
1def _make_ansi_codes(self, color_system: ColorSystem) -> str:
2 """Generate ANSI codes for this style.
3
4 Args:
5 color_system (ColorSystem): Color system.
6
7 Returns:
8 str: String containing codes.
9 """
10
11 if self._ansi is None:
12 sgr: List[str] = []
13 append = sgr.append
14 _style_map = self._style_map
15 attributes = self._attributes & self._set_attributes
16 if attributes:
17 if attributes & 1:
18 append(_style_map[0])
19 if attributes & 2:
20 append(_style_map[1])
21 if attributes & 4:
22 append(_style_map[2])
23 if attributes & 8:
24 append(_style_map[3])
25 if attributes & 0b0000111110000:
26 for bit in range(4, 9):
27 if attributes & (1 << bit):
28 append(_style_map[bit])
29 if attributes & 0b1111000000000:
30 for bit in range(9, 13):
31 if attributes & (1 << bit):
32 append(_style_map[bit])
33 if self._color is not None:
34 sgr.extend(self._color.downgrade(color_system).get_ansi_codes())
35 if self._bgcolor is not None:
36 sgr.extend(
37 self._bgcolor.downgrade(color_system).get_ansi_codes(
38 foreground=False
39 )
40 )
41 self._ansi = ";".join(sgr)
42 return self._ansi
Path 10: 3 calls (0.01)
ColorSystem (3)
'' (3)
1def _make_ansi_codes(self, color_system: ColorSystem) -> str:
2 """Generate ANSI codes for this style.
3
4 Args:
5 color_system (ColorSystem): Color system.
6
7 Returns:
8 str: String containing codes.
9 """
10
11 if self._ansi is None:
12 sgr: List[str] = []
13 append = sgr.append
14 _style_map = self._style_map
15 attributes = self._attributes & self._set_attributes
16 if attributes:
17 if attributes & 1:
18 append(_style_map[0])
19 if attributes & 2:
20 append(_style_map[1])
21 if attributes & 4:
22 append(_style_map[2])
23 if attributes & 8:
24 append(_style_map[3])
25 if attributes & 0b0000111110000:
26 for bit in range(4, 9):
27 if attributes & (1 << bit):
28 append(_style_map[bit])
29 if attributes & 0b1111000000000:
30 for bit in range(9, 13):
31 if attributes & (1 << bit):
32 append(_style_map[bit])
33 if self._color is not None:
34 sgr.extend(self._color.downgrade(color_system).get_ansi_codes())
35 if self._bgcolor is not None:
36 sgr.extend(
37 self._bgcolor.downgrade(color_system).get_ansi_codes(
38 foreground=False
39 )
40 )
41 self._ansi = ";".join(sgr)
42 return self._ansi
Path 11: 3 calls (0.01)
ColorSystem (3)
'9' (1) '7' (1) '5' (1)
1def _make_ansi_codes(self, color_system: ColorSystem) -> str:
2 """Generate ANSI codes for this style.
3
4 Args:
5 color_system (ColorSystem): Color system.
6
7 Returns:
8 str: String containing codes.
9 """
10
11 if self._ansi is None:
12 sgr: List[str] = []
13 append = sgr.append
14 _style_map = self._style_map
15 attributes = self._attributes & self._set_attributes
16 if attributes:
17 if attributes & 1:
18 append(_style_map[0])
19 if attributes & 2:
20 append(_style_map[1])
21 if attributes & 4:
22 append(_style_map[2])
23 if attributes & 8:
24 append(_style_map[3])
25 if attributes & 0b0000111110000:
26 for bit in range(4, 9):
27 if attributes & (1 << bit):
28 append(_style_map[bit])
29 if attributes & 0b1111000000000:
30 for bit in range(9, 13):
31 if attributes & (1 << bit):
32 append(_style_map[bit])
33 if self._color is not None:
34 sgr.extend(self._color.downgrade(color_system).get_ansi_codes())
35 if self._bgcolor is not None:
36 sgr.extend(
37 self._bgcolor.downgrade(color_system).get_ansi_codes(
38 foreground=False
39 )
40 )
41 self._ansi = ";".join(sgr)
42 return self._ansi
Path 12: 3 calls (0.01)
ColorSystem (3)
'7;38;2;166;226;46;48;2;39;40;34' (1) '9;38;2;248;248;242;48;2;39;40;34' (1) '9;38;2;249;38;114;48;2;39;40;34' (1)
1def _make_ansi_codes(self, color_system: ColorSystem) -> str:
2 """Generate ANSI codes for this style.
3
4 Args:
5 color_system (ColorSystem): Color system.
6
7 Returns:
8 str: String containing codes.
9 """
10
11 if self._ansi is None:
12 sgr: List[str] = []
13 append = sgr.append
14 _style_map = self._style_map
15 attributes = self._attributes & self._set_attributes
16 if attributes:
17 if attributes & 1:
18 append(_style_map[0])
19 if attributes & 2:
20 append(_style_map[1])
21 if attributes & 4:
22 append(_style_map[2])
23 if attributes & 8:
24 append(_style_map[3])
25 if attributes & 0b0000111110000:
26 for bit in range(4, 9):
27 if attributes & (1 << bit):
28 append(_style_map[bit])
29 if attributes & 0b1111000000000:
30 for bit in range(9, 13):
31 if attributes & (1 << bit):
32 append(_style_map[bit])
33 if self._color is not None:
34 sgr.extend(self._color.downgrade(color_system).get_ansi_codes())
35 if self._bgcolor is not None:
36 sgr.extend(
37 self._bgcolor.downgrade(color_system).get_ansi_codes(
38 foreground=False
39 )
40 )
41 self._ansi = ";".join(sgr)
42 return self._ansi
Path 13: 2 calls (0.0)
ColorSystem (2)
'2;38;2;117;113;94;48;2;39;40;34' (2)
1def _make_ansi_codes(self, color_system: ColorSystem) -> str:
2 """Generate ANSI codes for this style.
3
4 Args:
5 color_system (ColorSystem): Color system.
6
7 Returns:
8 str: String containing codes.
9 """
10
11 if self._ansi is None:
12 sgr: List[str] = []
13 append = sgr.append
14 _style_map = self._style_map
15 attributes = self._attributes & self._set_attributes
16 if attributes:
17 if attributes & 1:
18 append(_style_map[0])
19 if attributes & 2:
20 append(_style_map[1])
21 if attributes & 4:
22 append(_style_map[2])
23 if attributes & 8:
24 append(_style_map[3])
25 if attributes & 0b0000111110000:
26 for bit in range(4, 9):
27 if attributes & (1 << bit):
28 append(_style_map[bit])
29 if attributes & 0b1111000000000:
30 for bit in range(9, 13):
31 if attributes & (1 << bit):
32 append(_style_map[bit])
33 if self._color is not None:
34 sgr.extend(self._color.downgrade(color_system).get_ansi_codes())
35 if self._bgcolor is not None:
36 sgr.extend(
37 self._bgcolor.downgrade(color_system).get_ansi_codes(
38 foreground=False
39 )
40 )
41 self._ansi = ";".join(sgr)
42 return self._ansi
Path 14: 2 calls (0.0)
ColorSystem (2)
'1;4' (2)
1def _make_ansi_codes(self, color_system: ColorSystem) -> str:
2 """Generate ANSI codes for this style.
3
4 Args:
5 color_system (ColorSystem): Color system.
6
7 Returns:
8 str: String containing codes.
9 """
10
11 if self._ansi is None:
12 sgr: List[str] = []
13 append = sgr.append
14 _style_map = self._style_map
15 attributes = self._attributes & self._set_attributes
16 if attributes:
17 if attributes & 1:
18 append(_style_map[0])
19 if attributes & 2:
20 append(_style_map[1])
21 if attributes & 4:
22 append(_style_map[2])
23 if attributes & 8:
24 append(_style_map[3])
25 if attributes & 0b0000111110000:
26 for bit in range(4, 9):
27 if attributes & (1 << bit):
28 append(_style_map[bit])
29 if attributes & 0b1111000000000:
30 for bit in range(9, 13):
31 if attributes & (1 << bit):
32 append(_style_map[bit])
33 if self._color is not None:
34 sgr.extend(self._color.downgrade(color_system).get_ansi_codes())
35 if self._bgcolor is not None:
36 sgr.extend(
37 self._bgcolor.downgrade(color_system).get_ansi_codes(
38 foreground=False
39 )
40 )
41 self._ansi = ";".join(sgr)
42 return self._ansi
Path 15: 1 calls (0.0)
ColorSystem (1)
'3' (1)
1def _make_ansi_codes(self, color_system: ColorSystem) -> str:
2 """Generate ANSI codes for this style.
3
4 Args:
5 color_system (ColorSystem): Color system.
6
7 Returns:
8 str: String containing codes.
9 """
10
11 if self._ansi is None:
12 sgr: List[str] = []
13 append = sgr.append
14 _style_map = self._style_map
15 attributes = self._attributes & self._set_attributes
16 if attributes:
17 if attributes & 1:
18 append(_style_map[0])
19 if attributes & 2:
20 append(_style_map[1])
21 if attributes & 4:
22 append(_style_map[2])
23 if attributes & 8:
24 append(_style_map[3])
25 if attributes & 0b0000111110000:
26 for bit in range(4, 9):
27 if attributes & (1 << bit):
28 append(_style_map[bit])
29 if attributes & 0b1111000000000:
30 for bit in range(9, 13):
31 if attributes & (1 << bit):
32 append(_style_map[bit])
33 if self._color is not None:
34 sgr.extend(self._color.downgrade(color_system).get_ansi_codes())
35 if self._bgcolor is not None:
36 sgr.extend(
37 self._bgcolor.downgrade(color_system).get_ansi_codes(
38 foreground=False
39 )
40 )
41 self._ansi = ";".join(sgr)
42 return self._ansi
Path 16: 1 calls (0.0)
ColorSystem (1)
'4' (1)
1def _make_ansi_codes(self, color_system: ColorSystem) -> str:
2 """Generate ANSI codes for this style.
3
4 Args:
5 color_system (ColorSystem): Color system.
6
7 Returns:
8 str: String containing codes.
9 """
10
11 if self._ansi is None:
12 sgr: List[str] = []
13 append = sgr.append
14 _style_map = self._style_map
15 attributes = self._attributes & self._set_attributes
16 if attributes:
17 if attributes & 1:
18 append(_style_map[0])
19 if attributes & 2:
20 append(_style_map[1])
21 if attributes & 4:
22 append(_style_map[2])
23 if attributes & 8:
24 append(_style_map[3])
25 if attributes & 0b0000111110000:
26 for bit in range(4, 9):
27 if attributes & (1 << bit):
28 append(_style_map[bit])
29 if attributes & 0b1111000000000:
30 for bit in range(9, 13):
31 if attributes & (1 << bit):
32 append(_style_map[bit])
33 if self._color is not None:
34 sgr.extend(self._color.downgrade(color_system).get_ansi_codes())
35 if self._bgcolor is not None:
36 sgr.extend(
37 self._bgcolor.downgrade(color_system).get_ansi_codes(
38 foreground=False
39 )
40 )
41 self._ansi = ";".join(sgr)
42 return self._ansi
Path 17: 1 calls (0.0)
ColorSystem (1)
'1;2;34' (1)
1def _make_ansi_codes(self, color_system: ColorSystem) -> str:
2 """Generate ANSI codes for this style.
3
4 Args:
5 color_system (ColorSystem): Color system.
6
7 Returns:
8 str: String containing codes.
9 """
10
11 if self._ansi is None:
12 sgr: List[str] = []
13 append = sgr.append
14 _style_map = self._style_map
15 attributes = self._attributes & self._set_attributes
16 if attributes:
17 if attributes & 1:
18 append(_style_map[0])
19 if attributes & 2:
20 append(_style_map[1])
21 if attributes & 4:
22 append(_style_map[2])
23 if attributes & 8:
24 append(_style_map[3])
25 if attributes & 0b0000111110000:
26 for bit in range(4, 9):
27 if attributes & (1 << bit):
28 append(_style_map[bit])
29 if attributes & 0b1111000000000:
30 for bit in range(9, 13):
31 if attributes & (1 << bit):
32 append(_style_map[bit])
33 if self._color is not None:
34 sgr.extend(self._color.downgrade(color_system).get_ansi_codes())
35 if self._bgcolor is not None:
36 sgr.extend(
37 self._bgcolor.downgrade(color_system).get_ansi_codes(
38 foreground=False
39 )
40 )
41 self._ansi = ";".join(sgr)
42 return self._ansi
Path 18: 1 calls (0.0)
ColorSystem (1)
'2;3;34' (1)
1def _make_ansi_codes(self, color_system: ColorSystem) -> str:
2 """Generate ANSI codes for this style.
3
4 Args:
5 color_system (ColorSystem): Color system.
6
7 Returns:
8 str: String containing codes.
9 """
10
11 if self._ansi is None:
12 sgr: List[str] = []
13 append = sgr.append
14 _style_map = self._style_map
15 attributes = self._attributes & self._set_attributes
16 if attributes:
17 if attributes & 1:
18 append(_style_map[0])
19 if attributes & 2:
20 append(_style_map[1])
21 if attributes & 4:
22 append(_style_map[2])
23 if attributes & 8:
24 append(_style_map[3])
25 if attributes & 0b0000111110000:
26 for bit in range(4, 9):
27 if attributes & (1 << bit):
28 append(_style_map[bit])
29 if attributes & 0b1111000000000:
30 for bit in range(9, 13):
31 if attributes & (1 << bit):
32 append(_style_map[bit])
33 if self._color is not None:
34 sgr.extend(self._color.downgrade(color_system).get_ansi_codes())
35 if self._bgcolor is not None:
36 sgr.extend(
37 self._bgcolor.downgrade(color_system).get_ansi_codes(
38 foreground=False
39 )
40 )
41 self._ansi = ";".join(sgr)
42 return self._ansi
Path 19: 1 calls (0.0)
ColorSystem (1)
'1;2' (1)
1def _make_ansi_codes(self, color_system: ColorSystem) -> str:
2 """Generate ANSI codes for this style.
3
4 Args:
5 color_system (ColorSystem): Color system.
6
7 Returns:
8 str: String containing codes.
9 """
10
11 if self._ansi is None:
12 sgr: List[str] = []
13 append = sgr.append
14 _style_map = self._style_map
15 attributes = self._attributes & self._set_attributes
16 if attributes:
17 if attributes & 1:
18 append(_style_map[0])
19 if attributes & 2:
20 append(_style_map[1])
21 if attributes & 4:
22 append(_style_map[2])
23 if attributes & 8:
24 append(_style_map[3])
25 if attributes & 0b0000111110000:
26 for bit in range(4, 9):
27 if attributes & (1 << bit):
28 append(_style_map[bit])
29 if attributes & 0b1111000000000:
30 for bit in range(9, 13):
31 if attributes & (1 << bit):
32 append(_style_map[bit])
33 if self._color is not None:
34 sgr.extend(self._color.downgrade(color_system).get_ansi_codes())
35 if self._bgcolor is not None:
36 sgr.extend(
37 self._bgcolor.downgrade(color_system).get_ansi_codes(
38 foreground=False
39 )
40 )
41 self._ansi = ";".join(sgr)
42 return self._ansi
Path 20: 1 calls (0.0)
ColorSystem (1)
'4;34' (1)
1def _make_ansi_codes(self, color_system: ColorSystem) -> str:
2 """Generate ANSI codes for this style.
3
4 Args:
5 color_system (ColorSystem): Color system.
6
7 Returns:
8 str: String containing codes.
9 """
10
11 if self._ansi is None:
12 sgr: List[str] = []
13 append = sgr.append
14 _style_map = self._style_map
15 attributes = self._attributes & self._set_attributes
16 if attributes:
17 if attributes & 1:
18 append(_style_map[0])
19 if attributes & 2:
20 append(_style_map[1])
21 if attributes & 4:
22 append(_style_map[2])
23 if attributes & 8:
24 append(_style_map[3])
25 if attributes & 0b0000111110000:
26 for bit in range(4, 9):
27 if attributes & (1 << bit):
28 append(_style_map[bit])
29 if attributes & 0b1111000000000:
30 for bit in range(9, 13):
31 if attributes & (1 << bit):
32 append(_style_map[bit])
33 if self._color is not None:
34 sgr.extend(self._color.downgrade(color_system).get_ansi_codes())
35 if self._bgcolor is not None:
36 sgr.extend(
37 self._bgcolor.downgrade(color_system).get_ansi_codes(
38 foreground=False
39 )
40 )
41 self._ansi = ";".join(sgr)
42 return self._ansi
Path 21: 1 calls (0.0)
ColorSystem (1)
'1;2;3;4;5;6;7;8;9;21;51;52;53;31;40' (1)
1def _make_ansi_codes(self, color_system: ColorSystem) -> str:
2 """Generate ANSI codes for this style.
3
4 Args:
5 color_system (ColorSystem): Color system.
6
7 Returns:
8 str: String containing codes.
9 """
10
11 if self._ansi is None:
12 sgr: List[str] = []
13 append = sgr.append
14 _style_map = self._style_map
15 attributes = self._attributes & self._set_attributes
16 if attributes:
17 if attributes & 1:
18 append(_style_map[0])
19 if attributes & 2:
20 append(_style_map[1])
21 if attributes & 4:
22 append(_style_map[2])
23 if attributes & 8:
24 append(_style_map[3])
25 if attributes & 0b0000111110000:
26 for bit in range(4, 9):
27 if attributes & (1 << bit):
28 append(_style_map[bit])
29 if attributes & 0b1111000000000:
30 for bit in range(9, 13):
31 if attributes & (1 << bit):
32 append(_style_map[bit])
33 if self._color is not None:
34 sgr.extend(self._color.downgrade(color_system).get_ansi_codes())
35 if self._bgcolor is not None:
36 sgr.extend(
37 self._bgcolor.downgrade(color_system).get_ansi_codes(
38 foreground=False
39 )
40 )
41 self._ansi = ";".join(sgr)
42 return self._ansi
Path 22: 1 calls (0.0)
ColorSystem (1)
'53;38;2;102;217;239;48;2;39;40;34' (1)
1def _make_ansi_codes(self, color_system: ColorSystem) -> str:
2 """Generate ANSI codes for this style.
3
4 Args:
5 color_system (ColorSystem): Color system.
6
7 Returns:
8 str: String containing codes.
9 """
10
11 if self._ansi is None:
12 sgr: List[str] = []
13 append = sgr.append
14 _style_map = self._style_map
15 attributes = self._attributes & self._set_attributes
16 if attributes:
17 if attributes & 1:
18 append(_style_map[0])
19 if attributes & 2:
20 append(_style_map[1])
21 if attributes & 4:
22 append(_style_map[2])
23 if attributes & 8:
24 append(_style_map[3])
25 if attributes & 0b0000111110000:
26 for bit in range(4, 9):
27 if attributes & (1 << bit):
28 append(_style_map[bit])
29 if attributes & 0b1111000000000:
30 for bit in range(9, 13):
31 if attributes & (1 << bit):
32 append(_style_map[bit])
33 if self._color is not None:
34 sgr.extend(self._color.downgrade(color_system).get_ansi_codes())
35 if self._bgcolor is not None:
36 sgr.extend(
37 self._bgcolor.downgrade(color_system).get_ansi_codes(
38 foreground=False
39 )
40 )
41 self._ansi = ";".join(sgr)
42 return self._ansi
Path 23: 1 calls (0.0)
ColorSystem (1)
'4;38;2;166;226;46;48;2;39;40;34' (1)
1def _make_ansi_codes(self, color_system: ColorSystem) -> str:
2 """Generate ANSI codes for this style.
3
4 Args:
5 color_system (ColorSystem): Color system.
6
7 Returns:
8 str: String containing codes.
9 """
10
11 if self._ansi is None:
12 sgr: List[str] = []
13 append = sgr.append
14 _style_map = self._style_map
15 attributes = self._attributes & self._set_attributes
16 if attributes:
17 if attributes & 1:
18 append(_style_map[0])
19 if attributes & 2:
20 append(_style_map[1])
21 if attributes & 4:
22 append(_style_map[2])
23 if attributes & 8:
24 append(_style_map[3])
25 if attributes & 0b0000111110000:
26 for bit in range(4, 9):
27 if attributes & (1 << bit):
28 append(_style_map[bit])
29 if attributes & 0b1111000000000:
30 for bit in range(9, 13):
31 if attributes & (1 << bit):
32 append(_style_map[bit])
33 if self._color is not None:
34 sgr.extend(self._color.downgrade(color_system).get_ansi_codes())
35 if self._bgcolor is not None:
36 sgr.extend(
37 self._bgcolor.downgrade(color_system).get_ansi_codes(
38 foreground=False
39 )
40 )
41 self._ansi = ";".join(sgr)
42 return self._ansi
Path 24: 1 calls (0.0)
ColorSystem (1)
'1;4;38;2;166;226;46;48;2;39;40;34' (1)
1def _make_ansi_codes(self, color_system: ColorSystem) -> str:
2 """Generate ANSI codes for this style.
3
4 Args:
5 color_system (ColorSystem): Color system.
6
7 Returns:
8 str: String containing codes.
9 """
10
11 if self._ansi is None:
12 sgr: List[str] = []
13 append = sgr.append
14 _style_map = self._style_map
15 attributes = self._attributes & self._set_attributes
16 if attributes:
17 if attributes & 1:
18 append(_style_map[0])
19 if attributes & 2:
20 append(_style_map[1])
21 if attributes & 4:
22 append(_style_map[2])
23 if attributes & 8:
24 append(_style_map[3])
25 if attributes & 0b0000111110000:
26 for bit in range(4, 9):
27 if attributes & (1 << bit):
28 append(_style_map[bit])
29 if attributes & 0b1111000000000:
30 for bit in range(9, 13):
31 if attributes & (1 << bit):
32 append(_style_map[bit])
33 if self._color is not None:
34 sgr.extend(self._color.downgrade(color_system).get_ansi_codes())
35 if self._bgcolor is not None:
36 sgr.extend(
37 self._bgcolor.downgrade(color_system).get_ansi_codes(
38 foreground=False
39 )
40 )
41 self._ansi = ";".join(sgr)
42 return self._ansi
Path 25: 1 calls (0.0)
ColorSystem (1)
'3;4' (1)
1def _make_ansi_codes(self, color_system: ColorSystem) -> str:
2 """Generate ANSI codes for this style.
3
4 Args:
5 color_system (ColorSystem): Color system.
6
7 Returns:
8 str: String containing codes.
9 """
10
11 if self._ansi is None:
12 sgr: List[str] = []
13 append = sgr.append
14 _style_map = self._style_map
15 attributes = self._attributes & self._set_attributes
16 if attributes:
17 if attributes & 1:
18 append(_style_map[0])
19 if attributes & 2:
20 append(_style_map[1])
21 if attributes & 4:
22 append(_style_map[2])
23 if attributes & 8:
24 append(_style_map[3])
25 if attributes & 0b0000111110000:
26 for bit in range(4, 9):
27 if attributes & (1 << bit):
28 append(_style_map[bit])
29 if attributes & 0b1111000000000:
30 for bit in range(9, 13):
31 if attributes & (1 << bit):
32 append(_style_map[bit])
33 if self._color is not None:
34 sgr.extend(self._color.downgrade(color_system).get_ansi_codes())
35 if self._bgcolor is not None:
36 sgr.extend(
37 self._bgcolor.downgrade(color_system).get_ansi_codes(
38 foreground=False
39 )
40 )
41 self._ansi = ";".join(sgr)
42 return self._ansi