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

Method _get_number_styles

rich/syntax.py:602–623  ·  rich/syntax.py::Syntax._get_number_styles

Get background, number, and highlight styles for line numbers.

(self, console: Console)

Source from the content-addressed store, hash-verified

600 return column_width
601
602 def _get_number_styles(self, console: Console) -> Tuple[Style, Style, Style]:
603 class="st">""class="st">"Get background, number, and highlight styles for line numbers."class="st">""
604 background_style = self._get_base_style()
605 if background_style.transparent_background:
606 return Style.null(), Style(dim=True), Style.null()
607 if console.color_system in (class="st">"256", class="st">"truecolor"):
608 number_style = Style.chain(
609 background_style,
610 self._theme.get_style_for_token(Token.Text),
611 Style(color=self._get_line_numbers_color()),
612 self.background_style,
613 )
614 highlight_number_style = Style.chain(
615 background_style,
616 self._theme.get_style_for_token(Token.Text),
617 Style(bold=True, color=self._get_line_numbers_color(0.9)),
618 self.background_style,
619 )
620 else:
621 number_style = background_style + Style(dim=True)
622 highlight_number_style = background_style + Style(dim=False)
623 return background_style, number_style, highlight_number_style
624
625 def __rich_measure__(
626 self, console: class="st">"Console", options: class="st">"ConsoleOptions"

Callers 2

test_get_number_stylesFunction · 0.95
_get_syntaxMethod · 0.95

Calls 6

_get_base_styleMethod · 0.95
StyleClass · 0.85
nullMethod · 0.80
chainMethod · 0.80
get_style_for_tokenMethod · 0.45

Tested by 1

test_get_number_stylesFunction · 0.76