Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/rich/terminal_theme.py: 100%
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1from .color_triplet import ColorTriplet
2from .palette import Palette
4_ColorTuple = tuple[int, int, int]
7class TerminalTheme:
8 """A color theme used when exporting console content.
10 Args:
11 background (tuple[int, int, int]): The background color.
12 foreground (tuple[int, int, int]): The foreground (text) color.
13 normal (list[tuple[int, int, int]]): A list of 8 normal intensity colors.
14 bright (list[tuple[int, int, int]], optional): A list of 8 bright colors, or None
15 to repeat normal intensity. Defaults to None.
16 """
18 def __init__(
19 self,
20 background: _ColorTuple,
21 foreground: _ColorTuple,
22 normal: list[_ColorTuple],
23 bright: list[_ColorTuple] | None = None,
24 ) -> None:
25 self.background_color = ColorTriplet(*background)
26 self.foreground_color = ColorTriplet(*foreground)
27 self.ansi_colors = Palette(normal + (bright or normal))
30DEFAULT_TERMINAL_THEME = TerminalTheme(
31 (255, 255, 255),
32 (0, 0, 0),
33 [
34 (0, 0, 0),
35 (128, 0, 0),
36 (0, 128, 0),
37 (128, 128, 0),
38 (0, 0, 128),
39 (128, 0, 128),
40 (0, 128, 128),
41 (192, 192, 192),
42 ],
43 [
44 (128, 128, 128),
45 (255, 0, 0),
46 (0, 255, 0),
47 (255, 255, 0),
48 (0, 0, 255),
49 (255, 0, 255),
50 (0, 255, 255),
51 (255, 255, 255),
52 ],
53)
55MONOKAI = TerminalTheme(
56 (12, 12, 12),
57 (217, 217, 217),
58 [
59 (26, 26, 26),
60 (244, 0, 95),
61 (152, 224, 36),
62 (253, 151, 31),
63 (157, 101, 255),
64 (244, 0, 95),
65 (88, 209, 235),
66 (196, 197, 181),
67 (98, 94, 76),
68 ],
69 [
70 (244, 0, 95),
71 (152, 224, 36),
72 (224, 213, 97),
73 (157, 101, 255),
74 (244, 0, 95),
75 (88, 209, 235),
76 (246, 246, 239),
77 ],
78)
79DIMMED_MONOKAI = TerminalTheme(
80 (25, 25, 25),
81 (185, 188, 186),
82 [
83 (58, 61, 67),
84 (190, 63, 72),
85 (135, 154, 59),
86 (197, 166, 53),
87 (79, 118, 161),
88 (133, 92, 141),
89 (87, 143, 164),
90 (185, 188, 186),
91 (136, 137, 135),
92 ],
93 [
94 (251, 0, 31),
95 (15, 114, 47),
96 (196, 112, 51),
97 (24, 109, 227),
98 (251, 0, 103),
99 (46, 112, 109),
100 (253, 255, 185),
101 ],
102)
103NIGHT_OWLISH = TerminalTheme(
104 (255, 255, 255),
105 (64, 63, 83),
106 [
107 (1, 22, 39),
108 (211, 66, 62),
109 (42, 162, 152),
110 (218, 170, 1),
111 (72, 118, 214),
112 (64, 63, 83),
113 (8, 145, 106),
114 (122, 129, 129),
115 (122, 129, 129),
116 ],
117 [
118 (247, 110, 110),
119 (73, 208, 197),
120 (218, 194, 107),
121 (92, 167, 228),
122 (105, 112, 152),
123 (0, 201, 144),
124 (152, 159, 177),
125 ],
126)
128SVG_EXPORT_THEME = TerminalTheme(
129 (41, 41, 41),
130 (197, 200, 198),
131 [
132 (75, 78, 85),
133 (204, 85, 90),
134 (152, 168, 75),
135 (208, 179, 68),
136 (96, 138, 177),
137 (152, 114, 159),
138 (104, 160, 179),
139 (197, 200, 198),
140 (154, 155, 153),
141 ],
142 [
143 (255, 38, 39),
144 (0, 130, 61),
145 (208, 132, 66),
146 (25, 132, 233),
147 (255, 44, 122),
148 (57, 130, 128),
149 (253, 253, 197),
150 ],
151)