-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
Description
- I've checked docs and closed issues for possible solutions.
- I can't find my issue in the FAQ.
Describe the bug
See Textualize/textual#4227 (reply in thread) for context.
According to the Syntax documentation:
You can override the background color from the theme by supplying a background_color argument to the constructor.
However this doesn't seem to work as expected if the Syntax
has padding:
from rich.console import Console
from rich.syntax import Syntax
code = """\
def do_something():
pass\
"""
console = Console()
syntax = Syntax(
code,
lexer="python",
word_wrap=False,
indent_guides=True,
padding=(1, 2),
theme="material",
background_color="red",
)
console.print(syntax)
If you set the background_color
to the special value "default", this produces a different unexpected result:
Platform
Platform is Linux and tested in various terminal emulators.
$ pip freeze | grep rich
rich==13.6.0