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

Change Variable Highlighting Color #15

Open
kelleyjbrady opened this issue May 24, 2019 · 4 comments
Open

Change Variable Highlighting Color #15

kelleyjbrady opened this issue May 24, 2019 · 4 comments
Labels
enhancement New feature or request help wanted Extra attention is needed
Milestone

Comments

@kelleyjbrady
Copy link

The light blue and pink highlighting that Gather uses look great in the default grey+white Jupyter Lab theme, but highlighting REALLY highlights when you are in Dark mode or the Material Darker theme. Is there a way to tone things down that I am missing? Thanks!

@kelleyjbrady kelleyjbrady added the enhancement New feature or request label May 24, 2019
@andrewhead
Copy link
Collaborator

Hey @kelleyjbrady! I think you're absolutely right, the current colors make the code and UI buttons pretty unreadable in dark mode. This is what I'm seeing:

image

Yikes! That said, I think it would be pretty easy to get good colors for dark mode too.

One way would be to refactor the highlighting colors in index.css to use style variables from the themes (like these or these). This seems to be the recommended way in the developer guide which says "built-in and third party extensions should use these variables in their styles if at all possible."

The challenge with relying on theme variables is that I don't see any color variables for highlighting text's background in the dark theme, much less two different highlighting colors which we currently use to color both variable definitions and lines in the slice.

Another option is to add theme-specific coloring rules to index.css. Like this one, which in my web console sets the highlight color for variable definitions to black:

div.jp-ApplicationShell[data-theme-name="JupyterLab Dark"] span.cm-variable.jp-InputArea-editor-nametext {
    background-color: black;
}

I feel iffy about this specific selector as selecting using application shell node data seems brittle. But if there's a cleaner, more reliable selector for distinguishing between light and dark themes, that might be a way to include colors for both light and dark styles in the plugin.

Timing-wise, I'm on vacation these three weeks. If you wanted to take a stab at any of this that would be totally welcome. It would be great to have a PR for this enhancement.

@andrewhead andrewhead added the help wanted Extra attention is needed label Jun 28, 2019
@AndreCNF
Copy link

AndreCNF commented Feb 8, 2020

Is there any update on this color adaptation? I find this extension to be quite interesting and useful, but I want to use notebooks in dark mode.

Gather on JupyterLab light:
Screenshot 2020-02-08 at 18 01 45

Gather on JupyterLab dark:
Screenshot 2020-02-08 at 18 01 36

@andrewhead
Copy link
Collaborator

andrewhead commented Feb 8, 2020

Hi @AndreCNF! This isn't implemented yet, though on second look it would be a pretty straightforward implementation. What I didn't know in my last post on this thread was that JupyterLab already has a recommended way of enabling theme-dependent styling, as noted in this issue jupyterlab/jupyterlab#3681 and this pull request jupyterlab/jupyterlab#5078.

A quick prototype in the web inspector shows that the following selector...

[data-jp-theme-light="false"] .jp-InputArea-editor-nametext {
    background-color: rebeccapurple !important;
}

Can make the highlighting appear like so:

image

Should be a pretty straightforward fix, involving defining some theme-dependent style variables. Do you want to take a stab at it by any chance? If not, I might have a chance to revisit this in a few weeks when I loop back to batch process a few of the open issues.

@andrewhead andrewhead added this to To do in Development Plan Feb 11, 2020
@andrewhead andrewhead added this to the v0.7 milestone Feb 11, 2020
@hsadeghi
Copy link

hsadeghi commented Feb 9, 2023

it is possible to change error highlight color in Jupyter instead as explained here:
https://stackoverflow.com/questions/70766518/how-to-change-ipython-error-highlighting-color

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
Development Plan
  
To do 🤔
Development

No branches or pull requests

4 participants