-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
WIP,ENH: Load Qt stylesheet #9126
WIP,ENH: Load Qt stylesheet #9126
Conversation
You may interested @larsoner and @hoechenberger |
we should vendor https://github.com/ColinDuquesnoy/QDarkStyleSheet. This coupled with vendoring / adapting https://github.com/albertosottile/darkdetect is where I would start |
Instead of using |
Using it on the
Hm... It seems to be built at runtime: |
Ahh. Maybe it's worth having an optional dependency in this case. We could do the same thing with |
@GuillaumeFavelier This is unrelated to this particular PR, but in your screenshot I can see that in the double spinboxes, your decimal separators are commas, whereas underneath the time slider, it's periods. Would be good to unify this. I would say that ideally, the double spinboxes should ignore the system locale and use the American representation (periods), as we're using periods everywhere else in MNE already, ignoring locales – at least I think so |
@larsoner we could use For example, @marsipu created a MNE Color Picker where you can edit a stylesheet and visualize the result directly on the As @hoechenberger pointed out in an offline discussion, the icons need to be updated to follow the theme. For now, I would suggest something like: In ...
def set_theme(theme='auto', icons='auto'):
"""
Apply a theme.
Parameters
----------
theme : str
* 'auto' use `darkdetect` to choose between 'light' or 'dark' if `MNE_QT_STYLE_CSS` is not set
* 'light' default Qt theme
* 'dark' use `qdarkstyle` to set the theme
icons : str
* 'auto' opposite of `theme` for better contrast otherwise 'dark'
* 'light' or 'dark' icons
""" |
Thanks, I hate it 😁🤣😅 |
How about a new keyword argument for
Something like this? And then for |
Maybe we could even consider choosing the style on a more higher level to affect all Qt-Elements (Matplotlib with Qt-Backend, MNE-Coreg, PyVista-Plots)? |
I am not a big fan of global state changes made by one package that affect behaviors in other packages. It leads to all sorts of issues. I think if you want to change how matplotlib behaves everywhere, you should do it in matplotlib. So at least for now I'd rather we constrain our efforts here to just change how our plotters look, and even more focused, just Brain for now -- not all plots even made by MNE. Eventually we might be able to expand this but it's a much bigger effort and API discussion I think. See for example when package-wide matplotlib theme-setting was discussed and ultimately decided not to be done (I think): Hence the motivation to allow a way to configure just Brain, it's our own object made from Qt so we need to provide a way to style its Qt controls (and maybe someday Jupyter, not sure)... |
cc @drammock since you've thought about dark mode a bit |
I expect that 99% of mne users will not care much about this. So my only concern is that any change here does not reduce the chance of mne-python "just working out of the box". It should just work. Now if it works nicer out of the box it's even better |
my 2c: I think Alex underestimates how many users will want dark mode as an option. Having 2 presets and accepting a custom stylesheet seems reasonable as an API. I don't want to support anything more complex than that (like an interactive color picker). I strongly agree with Eric's point that we shouldn't modify MPL colors globally. Let's just start with brain (one of the harder cases) and then see how feasible it is to generalize. |
Closing in favor of #9149, the discussion can continue there :) |
This PR follows the discussion in #9000 (comment) and comes after the discussion with @marsipu. The goal is to load a stylesheet dynamically.
This is still work in progress. For now, it just loads a
data.txt
test file:For short, it gives full control over the style of all the
PyQt5
instances of_PyVistaRenderer
.ToDo: