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

[feat] Read dark/light theme on MacOS and Linux #387

Closed
kkoomen opened this issue May 8, 2022 · 4 comments · Fixed by #468
Closed

[feat] Read dark/light theme on MacOS and Linux #387

kkoomen opened this issue May 8, 2022 · 4 comments · Fixed by #468
Labels
platform: Linux platform: macOS priority: low Nice to have status: needs triage This issue or pull request needs to be investigated

Comments

@kkoomen
Copy link

kkoomen commented May 8, 2022

Describe the problem

Currently, the API can only read out the current system theme on Windows, but not on MacOS.

The following code below will result in light even though I'm in dark mode.

import { appWindow } from '@tauri-apps/api/window';

appWindow.theme().then((theme) => {
  console.log(theme); // returns 'light' even though I'm in dark mode
});

Describe the solution you'd like

This should work on MacOS as well.

Alternatives considered

None.

Additional context

N/A

@keiya01
Copy link
Member

keiya01 commented May 27, 2022

https://indiestack.com/2018/10/dark-mode-series-introduction/
I think this is useful but I could not find some property in objc.

@keiya01 keiya01 changed the title [feat] Read dark/light theme on MacOS [feat] Read dark/light theme on MacOS and Linux Jun 1, 2022
@keiya01
Copy link
Member

keiya01 commented Jun 1, 2022

This issue is resolved on macOS, but Linux has still this issue.

@Layendan
Copy link

Layendan commented Jun 28, 2022

Currently using Tao 0.11.2, Tauri 1.0.0, and MacOS 12.4.

Tested with your example using async/await instead of .then() and it did not work. It returned "light" no matter what system appearance I used. Using the provided "tauri://theme-changed" event listener DID return the correct appearance setting though.

Tested on two different MacBooks (M1 and x86) both resulted in the same problem.

@lucasfernog
Copy link
Member

@Layendan support on Tauri will be available in the next release (either tomorrow or wednesday).

@lucasfernog lucasfernog added status: needs triage This issue or pull request needs to be investigated and removed status: needs investigation labels Jul 1, 2022
@keiya01 keiya01 linked a pull request Jul 8, 2022 that will close this issue
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: Linux platform: macOS priority: low Nice to have status: needs triage This issue or pull request needs to be investigated
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants