-
Notifications
You must be signed in to change notification settings - Fork 290
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
Feature request - default themes for Python interactive window #3725
Comments
We have an outstanding issue (#3107) to fix up the colors for the python in the interactive window. Are you asking for more than just matching the python colors? Did you want theming for graphs and such too? |
Oh Well I do not know, a good start would be to have the same syntax coloring as in the editor. Because the python parts of the interactive window really hurt the eyes. But then, it would be nice to have the option to have something like https://github.com/jithurjacob/vscode-nbpreviewer or the Jupiter lab, with a white background. Because for example, if I want to show something "live", it would be more readable. |
a new issue was opened for this request by @IanMatthewHuff. |
@PierreMarchand20 In the meantime: |
Thx ! I know this one also: https://marketplace.visualstudio.com/items?itemName=donjayamanne.jupyter |
But I guess that at the end, the goal is to have all these features in |
@PierreMarchand20 indeed... |
@rchiodo The version |
How should I specify this if I use |
You'd put that command before your plot. Like so:
This goes into more detail: Essentially imagine we have a plt.style.use('dark_background') at the very top of your file (because that's what we do when you startup with a dark scheme) If you want to override just parts of it, this works:
|
Thanks for the information man... I just want the text labels to be black and eventually end up using:
|
+1 to fix this issue currently the interactive window is really hard to be used with dark themes |
@stefandeml what theme are you currently using? Some of the dark themes we aren't finding the colors for, but it should work for the default dark theme. |
I should also add, it's unlikely we'll be adding 'custom' jupyter themes anytime soon. We're going to make the vscode themes all work with our window, but I don't see us adding our own set of colors. |
@rchiodo can confirm that the default dark theme works, but nothing else. For example, I am using this: https://marketplace.visualstudio.com/items?itemName=zhuangtongfa.Material-theme |
The issue with changing the style is that is also reflected in exported figures. Example code: #%%
import matplotlib.pyplot as plt
import numpy as np
#%%
%matplotlib inline
#%%
x = np.linspace(0, 2 * np.pi, 100)
y = np.sin(x)
fig, ax = plt.subplots()
ax.plot(x, y)
fig.savefig('plot.png') If exexuted with, for example, the |
Without adding several themes for the jupyter window, just one similar to jupyter lab would be nice. Or at least a simple one with a white background and written black. This would make us able to export figures with a more neutral style. |
One potential idea would be for us to ship a vscode theme with special scopes. Right now a vscode theme has json like so for different colors:
We could add a theme like this with special scopes that we use just in our jupyter output. Something like:
Once we did that other people could make interactive themes based on other themes. (A theme can include other theme's json too) |
+1 for fixing on dark themes. Was really excited about the new interactive console... but what a shock when I saw the colors: Compare the functions above and below! I'm currently using Material Theme: Palenight High Contrast.
Looking forward to those additions @rchiodo ! |
@KenanHArik that theme should be working now. At least it does in our insiders build. Although make sure to reload VS code after installing. The 'Python Interactive' window isn't capable of updating themes while it's open. |
What does regular code look like? There's a known issue (#3175) with exception messages. Those colors are created by jupyter and not us. We need to just change the background on exceptions so that the jupyter colors work. |
Actually fixing microsoft/vscode-python#3175 is trivial. I'm going to add a setting to specify the background color for error messages and default it to white. |
See microsoft/vscode-python#4683 for the fix. That should make 'Palenight' work. |
Font settings should work, but you need to restart the Python Interactive window. |
Great, thanks! |
I think it should be possible. We save the default base theme for matplotlib in a variable. If you type in 'globals()' it should show it. Something like '_VSCode_defaultMatplotlib_Params' You can then put this in a cell to reset:
|
This combo worked beautifully: import matplotlib as mpl thank you! |
@jaymegordo are you asking if you can control the colors on text output? That's not currently possible. It uses the default font and colors for the theme. If that is what you wanted, what did you want to change? |
@rchiodo yes I was asking if its possible to modify the text output colors. I've modified my vs code theme (dark blue background) and wanted to match it. (I didn't realize that the interactive editor didn't have access to vs code theme colors.) Would be a nice feature to have if you're taking suggestions, thanks! |
How did you modify your theme? In your settings file? Our output is using this color right now:
If you set that in your settings, that should change the output color. |
We have access to some of the colors. The non-scope theme colors get set in our root css for our Python Interactive window. So the one above gets turned into a css var like so:
Scope theme colors (the ones we don't get) are the colors used in the editor for different tokens. |
@rchiodo YESSS perfect that's exactly what I wanted!! And thanks for the explanation. Not quite as important, but do you have a similar mapping for all the Python Interactive colors just in case I wanted to change anything else? Or just something to browse and see what I can change? |
Right now that information is in all of our CSS files in our code. Might be worth it to expose it somehow in a markdown file. I'll enter an issue for that. That --vscode-notifications-background is being used here: |
I entered an issue for figuring out this mapping: |
@rchiodo very excited to see the color in the interactive windows finally matches with the theme!!! There are two issues I want to ask:
|
We have an outstanding issue (#5701) of not picking up your user customizations for themes. Once we fix that, you can change the italicization of comments. You can only change the code fontsize in the interactive window by changing your code font size in the editor. |
seems like this issue could be closed now. |
@PierreMarchand20 at the beginning of this thread, you gave an example where the dark color theme made the graph background also black, do you know how to make it white, like this? |
One point I was making with this thread was that I did not how to do it. Then, reading the messages in the thread, you can either use the option By the way, I noticed that there is no more issue with the background error color right ? If so, I agree that we could close this issue since we can set a light Color theme to the interactive window (which was what I was asking for at the beginning). But the default theme with a dark theme has really improved so I actually do not use this option ^^ thank you ! |
@PierreMarchand20 Thanks! I tried ignoreVsCodeTheme, which kinda work (interactive window is all light theme now), but still not as good as Spyder (the screenshot I attached earlier), and I attach another one below. |
Well then you can try the second approach I suggested, it will be closer to what you want. The idea is to change the parameter of matplotlib. But @rchiodo will know better than me about this. |
Closing this as the original issue is resolved. |
Sorry wrong issue. Not sure we're going to do themes for the interactive window though. |
As I said in my previous message, I am ok to close it since allowing we can know use a light theme and most of the issues with colouring has been solved |
Thanks. Will close then. |
Consider the possibly to change the style of the Python Interactive window, especially when using jupyter, and providing a list of default themes, a style "JupyterLab" would be nice for example.
It would allow us to enhance the results, like Markdown Preview Enhanced enhances the markdown output (and provides a list of default themes) or VS Code Jupyter Notebook Previewer enhances its own window viewer.
The text was updated successfully, but these errors were encountered: