Get background, number, and highlight styles for line numbers.
(self, console: Console)
| 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" |