Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Match plugin text/axis/icon colours to the napari theme.#138

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

samcunliffe
Copy link
Collaborator

@samcunliffesamcunliffe commentedMay 31, 2023
edited
Loading

Change the text, axes, and icon colour to contrast with the background. I hear white text on an off-white background is not ideal.

Solves

Screenshot 2023-05-31 at 14 49 45

Testing:

  • The theme changing via theviewer.events.theme callback is currently only tested manually. It works better than the currentmain but is still not perfect. (I'm going to try and make a gif to show what I mean.)
  • The icon path stuff is unit tested ✅

Note for reviewer(s):

  • This somewhat supersedes my plan (and what I wrote in the PR title) forGeneralise stylesheet parsing to extract colours for light/dark theme callback. #105 but doesn't actually supersede the code changes.
    • ...so I'm going to keep that open for a bit longer (sorry for polluting the PR list). Will close when I decide what to do with it.
  • Are you OK with two face colours? I use boththeme.text andtheme.foreground.
  • The icons are black and not the subtle brownish grey used by napari's light theme.
  • Thenapari.Viewer gets moved up the family tree and becomes a member of theBaseNapariMPLWidget.

@samcunliffesamcunliffe added the BugSomething isn't working labelMay 31, 2023
@samcunliffesamcunliffe linked an issueMay 31, 2023 that may beclosed by this pull request
"""
self._replace_toolbar_icons()
if self.figure.gca():
self.apply_napari_colorscheme(self.figure.gca())
Copy link
CollaboratorAuthor

@samcunliffesamcunliffeMay 31, 2023
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Not sure if this is the correct line, but I still don't quite have a perfect UX when switching the theme whilst the widgets are open...

Screen.Recording.2023-05-31.at.16.51.00.mov

Re-opening or doing something to the plot seems to fix.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

A bit of a dive into thenapari source, and you might want to use something like this line to trigger something when the theme is changed?

https://github.com/napari/napari/blob/46dcc9c0976c35ec9dc64be60235f4addcadaa5c/napari/_qt/qt_main_window.py#L578

Copy link
CollaboratorAuthor

@samcunliffesamcunliffeMay 31, 2023
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

😞

napari.settings.get_settings().appearance.events.theme.connect(self._on_theme_change)

gives the same behaviour. I wonder if it might be a different way to do the same thing as

self.viewer.events.theme.connect(self._on_theme_change)

The theme-change event isundocumented* (scroll a bit from the start of § Viewer events) so I'd be up for asking and/or fixing the docs for napari.


*) It's also duplicated: that page is made via ascript in napari/docs.

Copy link
Collaborator

@ruaridhgruaridhg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM. Could switching the theme whilst widgets are open be something to do with the napari bug Iraised

@samcunliffe
Copy link
CollaboratorAuthor

Could switching the theme whilst widgets are open be something to do with the napari bug Inapari/napari#5847

Ithink not. Although something missing in the callbacks for a widget being loaded .... maybe.

@samcunliffe
Copy link
CollaboratorAuthor

samcunliffe commentedMay 31, 2023
edited
Loading

Also needs a note in the changelog.

@samcunliffesamcunliffeforce-pushed the86-handling-of-light-themes branch from276d6ac tod5c05c6CompareMay 31, 2023 18:01
@samcunliffe
Copy link
CollaboratorAuthor

Err if this is ok to merge, I think it needs a reapproval.

I pushed a release note and updated the pytest-mpl plots. Sorry for the noise.

@dstansby
Copy link
Member

dstansby commentedJun 1, 2023
edited
Loading

Happy to merge this (once I've checked the code), but things that need issues opening to be fixed after this:

  • If I switch to the light theme, the plot looks fine but the whole widget still has a dark background.
    Screenshot 2023-06-01 at 09 35 08
  • We couldn't get the theme changing event to work. Probably upstream issue, but also we should open an issue here so we don't forget.

Copy link
Member

@dstansbydstansby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Some minor comments, but overall looking 👍

@samcunliffe
Copy link
CollaboratorAuthor

but things that need issues opening to be fixed after this

Yeah. There are a few minor peripheral things that I noticed too...

  • Axistitles are always black.
  • Icons are black (and should properly be greyish brown to match the theme).

Are you ok with 3 individual minor issues?

@dstansby
Copy link
Member

Yep, three issues sounds good

@samcunliffesamcunliffe added this pull request to the merge queueJun 1, 2023
Merged via the queue intomatplotlib:main with commit7bf5db1Jun 1, 2023
@samcunliffesamcunliffe deleted the 86-handling-of-light-themes branchJune 1, 2023 10:02
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@ruaridhgruaridhgruaridhg approved these changes

@dstansbydstansbydstansby approved these changes

Assignees
No one assigned
Labels
BugSomething isn't working
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Hard-coded icons and axes looks bad with non-default napari themes
3 participants
@samcunliffe@dstansby@ruaridhg

[8]ページ先頭

©2009-2025 Movatter.jp