|
38 | 38 | ) |
39 | 39 | from .layout import LayoutMap, LayoutResult, LayoutRow, WrappedRow, layout_content_lines |
40 | 40 | from .render import RenderCell, RenderLine, RenderedScreen, ScreenOverlay |
41 | | -from .utils import ANSI_ESCAPE_SEQUENCE, THEME, StyleRef, wlen, gen_colors |
| 41 | +from .utils import ANSI_ESCAPE_SEQUENCE, ColorSpan, THEME, StyleRef, wlen, gen_colors |
42 | 42 | from .trace import trace |
43 | 43 |
|
44 | 44 |
|
45 | 45 | # types |
46 | 46 | Command = commands.Command |
| 47 | +from collections.abc import Callable, Iterator |
47 | 48 | from .types import ( |
48 | 49 | Callback, |
49 | 50 | CommandName, |
@@ -304,6 +305,7 @@ class Reader: |
304 | 305 | lxy: CursorXY = field(init=False) |
305 | 306 | scheduled_commands: list[CommandName] = field(default_factory=list) |
306 | 307 | can_colorize: bool = False |
| 308 | + gen_colors: Callable[[str], Iterator[ColorSpan]] = gen_colors |
307 | 309 | threading_hook: Callback | None = None |
308 | 310 | invalidation: RefreshInvalidation = field(init=False) |
309 | 311 |
|
@@ -534,7 +536,7 @@ def _build_content_lines( |
534 | 536 | prompt_from_cache: bool, |
535 | 537 | ) -> tuple[ContentLine, ...]: |
536 | 538 | if self.can_colorize: |
537 | | - colors = list(gen_colors(self.get_unicode())) |
| 539 | + colors = list(self.gen_colors(self.get_unicode())) |
538 | 540 | else: |
539 | 541 | colors = None |
540 | 542 | trace("colors = {colors}", colors=colors) |
|
0 commit comments