Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] print_json with unreadable keys on Jupyter Notebook #2484

Closed
ccrvlh opened this issue Aug 24, 2022 · 5 comments
Closed

[BUG] print_json with unreadable keys on Jupyter Notebook #2484

ccrvlh opened this issue Aug 24, 2022 · 5 comments

Comments

@ccrvlh
Copy link

ccrvlh commented Aug 24, 2022

JSON Keys are very dark (a darkish blue) that makes it unreadable on the Jupyter Notebook with fairly default VSCode settings (I'm using the Dracula theme).
Screen Shot 2022-08-24 at 00 05 01

Platform

Click to expand ```python from rich.diagnose import report report() ╭──────────────────── ─────────────────────╮ │ A high level console interface. │ │ │ │ ╭─────────────────────────────────────────────────────────────────────╮ │ │ │ │ │ │ ╰─────────────────────────────────────────────────────────────────────╯ │ │ │ │ color_system = 'truecolor' │ │ encoding = 'utf-8' │ │ file = │ │ height = 100 │ │ is_alt_screen = False │ │ is_dumb_terminal = False │ │ is_interactive = False │ │ is_jupyter = True │ │ is_terminal = False │ │ legacy_windows = False │ │ no_color = False │ │ options = ConsoleOptions( │ │ size=ConsoleDimensions(width=115, height=100), │ │ legacy_windows=False, │ │ min_width=1, │ │ max_width=115, │ │ is_terminal=False, │ │ encoding='utf-8', │ │ max_height=100, │ │ justify=None, │ │ overflow=None, │ │ no_wrap=False, │ │ highlight=None, │ │ markup=None, │ │ height=None │ │ ) │ │ quiet = False │ │ record = False │ │ safe_box = True │ │ size = ConsoleDimensions(width=115, height=100) │ │ soft_wrap = False │ │ stderr = False │ │ style = None │ │ tab_size = 8 │ │ width = 115 │ ╰─────────────────────────────────────────────────────────────────────────╯ ╭─── ────╮ │ Windows features available. │ │ │ │ ╭───────────────────────────────────────────────────╮ │ │ │ WindowsConsoleFeatures(vt=False, truecolor=False) │ │ │ ╰───────────────────────────────────────────────────╯ │ │ │ │ truecolor = False │ │ vt = False │ ╰───────────────────────────────────────────────────────╯ ╭────── Environment Variables ───────╮ │ { │ │ 'TERM': 'xterm-color', │ │ 'COLORTERM': None, │ │ 'CLICOLOR': '1', │ │ 'NO_COLOR': None, │ │ 'TERM_PROGRAM': None, │ │ 'COLUMNS': None, │ │ 'LINES': None, │ │ 'JUPYTER_COLUMNS': None, │ │ 'JUPYTER_LINES': None, │ │ 'JPY_PARENT_PID': None, │ │ 'VSCODE_VERBOSE_LOGGING': None │ │ } │ ╰────────────────────────────────────╯ platform="Darwin"

</details>
@willmcgugan
Copy link
Collaborator

The problem is that Rich can't know what you've set your theme to.

@willmcgugan
Copy link
Collaborator

In theory Rich could re-use styles supplied by the host. But there is no standard across Jupyter versions. I'm afraid there is not much we can do about it.

@github-actions
Copy link

github-actions bot commented Sep 2, 2022

Did I solve your problem?

Why not buy the devs a coffee to say thanks?

@ccrvlh
Copy link
Author

ccrvlh commented Sep 2, 2022

I imagine it should be tricky indeed.
As a suggestion for the future, if there was a dark/light toggle or something, at least there could be a way to fix the extremes. This wouldn't fix cases where the theme would interfere, but I would imagine that most folks use some variation of a dark theme in VSCode. Another option would to have print_json to accept a dict or tuple of colors to use.

@astr0gator
Copy link

@willmcgugan I totally agree with you logic. Having said that what's the best practice to use rich with dark theme? I have exactly the same problem with virtually any dark theme + dark default blue keys for json. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants