Skip to content

Wouldn't it be handy to extract figure colors directly from the napari theme? #236

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

Closed
Chris-N-K opened this issue Nov 28, 2023 · 5 comments
Labels
New feature New feature or request

Comments

@Chris-N-K
Copy link
Contributor

Thanks for your work :)

What would you think about using the colours provided by the napari theme itself instead of a static style sheet?
Dynamically pulling the colours for the figure parts from the current napari viewer theme, would add support for every style sheet an user could generates for napari.

A possible way to do this would be to extract the theme dict from the viewer: napari.utils.theme.get_theme(napari.current_viewer.theme, as_dict=True) and map the colours of interest to the corresponding rcParams keys. Afterwards, instead of providing a path to with matplotlib.style.context you could provide the dict with the rcParams keys and the color codes.

If you think this might be a good idea I would be happy to give it a try and make a pull-request.

@dstansby
Copy link
Member

I didn't know users could style napari! If that's the case, then pulling dynamically from that style would be much better than supporting a custom style sheet in napari-matplotlib, and a PR would be very welcome! 👍

@Chris-N-K
Copy link
Contributor Author

As far as I know you can actually make style plugins ^^

@Chris-N-K
Copy link
Contributor Author

Chris-N-K commented Nov 28, 2023

Checked it, you can even do this easily at runtime.
https://napari.org/stable/gallery/new_theme.html

@Chris-N-K
Copy link
Contributor Author

Made a pull request with an example implementation #237.

@dstansby dstansby added the New feature New feature or request label Jan 7, 2024
@Chris-N-K
Copy link
Contributor Author

Chris-N-K commented Jan 14, 2024

I close this issue as the feature was added through pull request #237

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

No branches or pull requests

2 participants