Skip to content
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

Fix the WebKit view not transitioning from light to dark mode #2542

Merged
merged 3 commits into from
Apr 21, 2024

Conversation

zorgiepoo
Copy link
Member

@zorgiepoo zorgiepoo commented Apr 21, 2024

adaptReleaseNotesAppearance was over-engineered to update the transparent background state of the web view (which was causing the issue) and the background NSBox view when the system changes to dark or light mode. This is partly because when dark mode support was originally written, it used to use a stylesheet that was only specific to dark aqua (and then the code worsened over time to adapt other view changes only to dark mode). This code has since changed some time ago to use a universal stylesheet for both light/dark mode.

So now when the WebKit view is created, we just opt into a transparent background and set up a background NSBox view once and don't do anything when the effectiveAppearance of the views change. This fixes visual issues on current and older OS systems when changing system appearance.

Fixes #2541

Misc Checklist

  • My change requires a documentation update on Sparkle's website repository
  • My change requires changes to generate_appcast, generate_keys, or sign_update

Testing

I tested and verified my change by using one or multiple of these methods:

  • Sparkle Test App
  • Unit Tests
  • My own app
  • Other (please specify)

Tested modern and legacy WebKit views being initially started in dark or light mode, and switching to other appearance.

macOS version tested:
macOS 14.4.1
macOS 12 VM
macOS 10.15 VM
macOS 10.14 VM

adaptReleaseNotesAppearance was over-engineered to update the transparent background state of the web view (which was causing the issue) and the background NSBox view when the system changes to dark or light mode. This is because when dark mode support was originally written, it used to use a stylesheet that was only specific to dark aqua. However this code has changed some time ago to use a universal stylesheet for both light/dark mode.

So now when the WebKit view is created, we just opt into a transparent background and set up a background NSBox view once and don't do anything when the effectiveAppearance of the views change. This fixes visual issues on current and older OS systems when changing system appearance.
@zorgiepoo zorgiepoo added this to the 2.6.1 milestone Apr 21, 2024
@zorgiepoo zorgiepoo merged commit 0cff817 into 2.x Apr 21, 2024
2 checks passed
@zorgiepoo zorgiepoo deleted the light-dark-mode-switch-fix branch April 21, 2024 22:58
@zorgiepoo
Copy link
Member Author

The scroller's appearance doesn't update immediately upon dark/light switching but that seems like a WebKit bug (FB13745239) which also affects webpages on Safari.

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

Successfully merging this pull request may close these issues.

Release notes dialog content displaying as white text on white background in dark mode
1 participant