-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Description
When a traceback is printed to a console which has a modified theme applied to it, the theme's styles are not used when printing the traceback.
Reproduction
In this example, I expect the border of the traceback to be blue and the "tag" name and contents to be black. Instead, the defaults continue to be used. Removing the theme="bw" does not produce the expect result either.
from rich.console import Console
from rich.theme import Theme
console = Console(theme=Theme({
"repr.tag_name": "bold black",
"repr.tag_contents": "black",
"traceback.border": "blue",
"traceback.border.syntax_error": "blue"}))
try: raise Exception
except Exception: console.print_exception(theme="bw", show_locals=True)Platform
MacOS, Terminal App (Happens in VS Code too.)
Diagnostics
$ python -m rich.diagnose
╭───────────────────────── <class 'rich.console.Console'> ─────────────────────────╮
│ A high level console interface. │
│ │
│ ╭──────────────────────────────────────────────────────────────────────────────╮ │
│ │ <console width=139 ColorSystem.EIGHT_BIT> │ │
│ ╰──────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ color_system = '256' │
│ encoding = 'utf-8' │
│ file = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'> │
│ height = 46 │
│ is_alt_screen = False │
│ is_dumb_terminal = False │
│ is_interactive = True │
│ is_jupyter = False │
│ is_terminal = True │
│ legacy_windows = False │
│ no_color = False │
│ options = ConsoleOptions( │
│ size=ConsoleDimensions(width=139, height=46), │
│ legacy_windows=False, │
│ min_width=1, │
│ max_width=139, │
│ is_terminal=True, │
│ encoding='utf-8', │
│ max_height=46, │
│ justify=None, │
│ overflow=None, │
│ no_wrap=False, │
│ highlight=None, │
│ markup=None, │
│ height=None │
│ ) │
│ quiet = False │
│ record = False │
│ safe_box = True │
│ size = ConsoleDimensions(width=139, height=46) │
│ soft_wrap = False │
│ stderr = False │
│ style = None │
│ tab_size = 8 │
│ width = 139 │
╰──────────────────────────────────────────────────────────────────────────────────╯
$ python -m rich._windows
platform="Darwin"
WindowsConsoleFeatures(vt=False, truecolor=False)
$ python -m pip freeze | grep rich
rich==10.16.1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working