Dark-mode to PyVista-Brain (pair-programmed with @GuillaumeFavelier)#9149
Dark-mode to PyVista-Brain (pair-programmed with @GuillaumeFavelier)#9149larsoner merged 14 commits intomne-tools:mainfrom
Conversation
mne/viz/_brain/_brain.py
Outdated
| to style the widgets. Automatic detection does not yet work on | ||
| Linux. Can also be a path-like to a custom style sheet. |
There was a problem hiding this comment.
I would open an upstream issue with darkdetect for this if they don't have one. In the meantime I would use:
gsettings get org.gnome.desktop.interface gtk-theme
if it ends in -dark assume it's dark. It at least works on my machine™ :)
|
@marsipu I pushed a commit to reorder |
Thank you @GuillaumeFavelier . I also thought we maybe could shorten the documentation-text a bit more like this? |
Sounds good 👍 |
mne/viz/_brain/_brain.py
Outdated
| theme : str | path-like | ||
| Can be "auto" (default), "light", or "dark" or a path-like to a | ||
| custom stylesheet. For Dark-Mode and automatic Dark-Mode-Detection, | ||
| `qdarkstyle` respectively `darkdetect` is required. |
There was a problem hiding this comment.
CircleCI seems to have some issues with the new modules:
/home/circleci/project/mne/viz/_brain/_brain.py:docstring of mne.viz._brain._brain.Brain:97: WARNING: py:obj reference target not found: qdarkstyle
/home/circleci/project/mne/viz/_brain/_brain.py:docstring of mne.viz._brain._brain.Brain:97: WARNING: py:obj reference target not found: darkdetect
Probably the docstring needs to be updated:
| `qdarkstyle` respectively `darkdetect` is required. | |
| :mod:`qdarkstyle` respectively :mod:`darkdetect` is required. |
And the list intersphinx_mapping in doc/conf.py too.
|
Somehow when I test it locally, the :mod:-phrases doesn't turn into a link leading to the websites. It is supposed to do that right? Do I maybe need to import |
|
The https://qdarkstylesheet.readthedocs.io/en/latest/reference/qdarkstyle.html I don't see a Sphinx documentation page for |
|
(or you could do a custom HTML link to the darkdetect pypi or GitHub page if you want) |
|
The failed test in |
|
This is what I saw: I don't think it's related and I don't see it happening on |
I've seen that on another PR too, agree it's unrelated. |
|
Indeed on albertosottile/darkdetect#8 and this branch after installing |
|
CIs are green – @marsipu @GuillaumeFavelier is this good to merge? |
|
We also talked about inverting the icon-pixmaps with the theme once and haven't done it yet. I am just trying to add it, but it may need another review from @GuillaumeFavelier. |
|
Yeah I think that's reasonable assuming it's not too difficult |
larsoner
left a comment
There was a problem hiding this comment.
Can you add a brain_kwargs=None to SourceEstimate.plot and VectorSourceEstimate.plot, and VolSourceEstimate.plot_3d? See for example how we handle add_data_kwargs, the difference being that brain_kwargs should be passed to the Brain constructor.
Co-authored-by: Eric Larson <larson.eric.d@gmail.com>
I am sorry, I can't follow you: I already see the parameter |
|
Oh I didn't realize we already had that param, never mind! |
|
Thanks @marsipu @GuillaumeFavelier ! |
|
😎 |
|
super good! |
|
Awesome work @marsipu 👌 |




This follows PR #9126.
What does this implement/fix?
Add a theme-parameter to Brain with PyVista-Renderer accepting 'dark', 'light' and 'auto'. Dark-Mode depends on qdarkstyle and the automatic detection works with darkdetect.