138 """Decode a line containing ansi codes.
141 line (str): A line of terminal output.
144 Text: A Text instance marked up according to ansi codes.
154 append(plain_text, self.
style or None)
155 elif osc
is not None:
157 _params, semicolon, link = osc[2:].partition(
";")
159 self.
style = self.
style.update_link(link
or None)
160 elif sgr
is not None:
164 min(255, int(_code)
if _code
else 0)
168 iter_codes = iter(codes)
169 for code
in iter_codes:
173 elif code
in SGR_STYLE_MAP:
178 with suppress(StopIteration):
179 color_type = next(iter_codes)
182 from_ansi(next(iter_codes))
184 elif color_type == 2:
194 with suppress(StopIteration):
195 color_type = next(iter_codes)
198 None, from_ansi(next(iter_codes))
200 elif color_type == 2: