feat: support cross-platform dark mode on Windows and Linux#1245
Merged
Conversation
…ark-mode # Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with '#' will be ignored, and an empty message aborts # the commit.
Owner
|
Thanks @mgaldamez, merged. Clean change: it mirrors the existing macOS theme logic onto Windows and Linux, regenerates One note for Linux users: dark mode there goes through WebKitGTK, so whether a page actually renders dark also depends on the WebKitGTK build honoring the window theme and the site implementing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR resolves the limitation where
--dark-modeinitialization and dynamic theme synchronization (update_theme_mode) were restricted only to macOS. It extends support for dark theme synchronization and forced dark mode to Windows and Linux (tested and verified on Fedora 44) using Tauri's native, cross-platform theme API.Changes
tauri::Themeimport: Removed macOS-only compilation guards (#[cfg(target_os = "macos")]) aroundThemeimports in bothwindow.rsandinvoke.rs`.dark_modepreference dynamically using.theme(theme)instead of forcing.theme(None).update_theme_modecommand handler to callwindow.set_themeon all target platforms, eliminating OS-specific guards.--dark-modedescriptions in the CLI parser configuration and user documentation (docs/cli-usage.mdanddocs/cli-usage_CN.md) to explicitly denote macOS, Windows, and Linux support.Verification
--dark-modesets the window theme to dark correctly.Closes #1244