-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Closed
Labels
status: backlogIssue is ready and we can work on itIssue is ready and we can work on itstatus: needs triageThis issue needs to triage, applied to new issuesThis issue needs to triage, applied to new issuestype: bug
Description
Describe the bug
No matter which theme I set in the Tauri config file, the WebView always answers CSS media query prefers-color-scheme with OS color theme. According to the doc, it should only be the behavior is the theme field is None.
There is a similar issue in Electron, and they managed to fix it by "propagate preferred color scheme to the renderer".
Reproduction
- Set Windows color mode in Personalization to "Dark".
- In tauri.conf.json, set
windows[0].themeto "Light". - In Rust
main(), call main window'stheme()to make sure it istauri::Theme::Light. - In CSS, have different style for of both
@media (prefers-color-scheme: light)and@media (prefers-color-scheme: dark). - Observe that the section in
@media (prefers-color-scheme: dark)is used.
Expected behavior
If theme() returns Light, styles in @media (prefers-color-scheme: light) should be used.
Platform and versions
Environment
› OS: Windows 10.0.22621 X64
› Webview2: 108.0.1462.44
› MSVC:
- Visual Studio Community 2022
› Node.js: 18.12.1
› npm: 8.19.2
› pnpm: 7.18.1
› yarn: Not installed!
› rustup: 1.25.1
› rustc: 1.65.0
› cargo: 1.65.0
› Rust toolchain: stable-x86_64-pc-windows-msvc
Packages
› @tauri-apps/cli [NPM]: 1.2.2
› @tauri-apps/api [NPM]: 1.2.0
› tauri [RUST]: 1.2.2,
› tauri-build [RUST]: 1.2.1,
› tao [RUST]: 0.15.6,
› wry [RUST]: 0.23.2,
App
› build-type: build
› CSP: unset
› distDir: ../dist
› devPath: http://localhost:1420/
› framework: Svelte
› bundler: Vite
App directory structure
├─ .git
├─ dist
├─ node_modules
├─ src
└─ src-tauri
Stack trace
No response
Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
status: backlogIssue is ready and we can work on itIssue is ready and we can work on itstatus: needs triageThis issue needs to triage, applied to new issuesThis issue needs to triage, applied to new issuestype: bug