Skip to content

feat: support cross-platform dark mode on Windows and Linux#1245

Merged
tw93 merged 4 commits into
tw93:mainfrom
mgaldamez:feat/cross-platform-dark-mode
Jun 21, 2026
Merged

feat: support cross-platform dark mode on Windows and Linux#1245
tw93 merged 4 commits into
tw93:mainfrom
mgaldamez:feat/cross-platform-dark-mode

Conversation

@mgaldamez

Copy link
Copy Markdown
Contributor

Description

This PR resolves the limitation where --dark-mode initialization 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

  1. Unconditional tauri::Theme import: Removed macOS-only compilation guards (#[cfg(target_os = "macos")]) around Themeimports in bothwindow.rsandinvoke.rs`.
  2. Cross-platform initialization: Updated window builder configuration on Windows/Linux to honor the dark_mode preference dynamically using .theme(theme) instead of forcing .theme(None).
  3. Cross-platform dynamic setting: Updated the update_theme_mode command handler to call window.set_theme on all target platforms, eliminating OS-specific guards.
  4. Documentation: Updated --dark-mode descriptions in the CLI parser configuration and user documentation (docs/cli-usage.md and docs/cli-usage_CN.md) to explicitly denote macOS, Windows, and Linux support.

Verification

  • Tested and verified at runtime on Fedora 44 that launching the app with --dark-mode sets the window theme to dark correctly.
  • All 12 Rust Cargo tests compiled and passed.
  • All 193 Vitest CLI tests passed successfully.

Closes #1244

…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.
@tw93 tw93 merged commit 44002c9 into tw93:main Jun 21, 2026
@tw93

tw93 commented Jun 21, 2026

Copy link
Copy Markdown
Owner

Thanks @mgaldamez, merged. Clean change: it mirrors the existing macOS theme logic onto Windows and Linux, regenerates dist/cli.js, and updates both English and Chinese docs. It'll ship in the next release.

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 prefers-color-scheme: dark.

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.

feat: support cross-platform dark mode on Windows and Linux

2 participants