-
-
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
When highlight
is set to False upon creation of Console (console = Console(highlight=False), it does not appear to re-enable later on if I set highlight=True
for an individual line.
I have only been learning Python for 3-4 weeks at most so far, so apologies if this is not actually a bug and I'm doing something incorrectly (or it actually is in the docs)
from rich.console import Console
console = Console(highlight=False)
# This works as intended with no highlighting applied to the numbers.
console.print('Testing 1 2 3')
# This does not, as the output is the same as the above even though I have tried to enable highlighting for this line.
console.print('Testing 1 2 3', highlight=True)
Platform
Click to expand
Windows 11, Windows Terminal
Windows 11, Visual Studio Code integrated terminal
Ubuntu 22.04, Visual Studio Code integrated terminal
python -m rich.diagnose:
╭───────────────────────── <class 'rich.console.Console'> ─────────────────────────╮
│ A high level console interface. │
│ │
│ ╭──────────────────────────────────────────────────────────────────────────────╮ │
│ │ <console width=198 ColorSystem.TRUECOLOR> │ │
│ ╰──────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ color_system = 'truecolor' │
│ encoding = 'utf-8' │
│ file = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'> │
│ height = 13 │
│ 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=198, height=13), │
│ legacy_windows=False, │
│ min_width=1, │
│ max_width=198, │
│ is_terminal=True, │
│ encoding='utf-8', │
│ max_height=13, │
│ justify=None, │
│ overflow=None, │
│ no_wrap=False, │
│ highlight=None, │
│ markup=None, │
│ height=None │
│ ) │
│ quiet = False │
│ record = False │
│ safe_box = True │
│ size = ConsoleDimensions(width=198, height=13) │
│ soft_wrap = False │
│ stderr = False │
│ style = None │
│ tab_size = 8 │
│ width = 198 │
╰──────────────────────────────────────────────────────────────────────────────────╯
╭─── <class 'rich._windows.WindowsConsoleFeatures'> ────╮
│ Windows features available. │
│ │
│ ╭───────────────────────────────────────────────────╮ │
│ │ WindowsConsoleFeatures(vt=False, truecolor=False) │ │
│ ╰───────────────────────────────────────────────────╯ │
│ │
│ truecolor = False │
│ vt = False │
╰───────────────────────────────────────────────────────╯
╭────── Environment Variables ───────╮
│ { │
│ 'TERM': 'xterm-256color', │
│ 'COLORTERM': 'truecolor', │
│ 'CLICOLOR': None, │
│ 'NO_COLOR': None, │
│ 'TERM_PROGRAM': 'vscode', │
│ 'COLUMNS': None, │
│ 'LINES': None, │
│ 'JUPYTER_COLUMNS': None, │
│ 'JUPYTER_LINES': None, │
│ 'JPY_PARENT_PID': None, │
│ 'VSCODE_VERBOSE_LOGGING': None │
│ } │
╰────────────────────────────────────╯
platform="Linux"
pip freeze | grep rich:
rich==13.7.1
TomJGooding