wyhaya / tauri-plugin-theme

Dynamically change Tauri App theme
46 stars 6 forks source link

Can the console control changing themes? #9

Closed ayangweb closed 2 weeks ago

ayangweb commented 1 month ago

Hey👋, right now updating the theme only changes the windows but not the console, is it possible to control the update together? And about windows needing to restart windows, I see that PR has already been proposed, hopefully it can be merged in sooner, thanks!

image
wyhaya commented 1 month ago

Hey👋, right now updating the theme only changes the windows but not the console, is it possible to control the update together?

When the console is not separated from your window, their appearance will be synchronized. Once they are separated, the console's appearance will fully follow the "system settings." I am not sure if there is a specific API to set the console theme, but if there is, I would be happy to improve it.

And about windows needing to restart windows, I see that PR has already been proposed, hopefully it can be merged in sooner, thanks!

To truly solve this issue, we need a perfect set_theme method:

  1. Set the window appearance to light mode.
  2. Set the window appearance to dark mode.
  3. Set the window appearance to match the system appearance.
  4. Synchronize the window appearance with the webview.
  5. Ensure compatibility with Windows 10.

After some time of trying, I think restart app is the best I can do.

ayangweb commented 1 month ago

Hey👋, right now updating the theme only changes the windows but not the console, is it possible to control the update together?

When the console is not separated from your window, their appearance will be synchronized. Once they are separated, the console's appearance will fully follow the "system settings." I am not sure if there is a specific API to set the console theme, but if there is, I would be happy to improve it.

Okay, thanks. I understand.

And about windows needing to restart windows, I see that PR has already been proposed, hopefully it can be merged in sooner, thanks!

To truly solve this issue, we need a perfect set_theme method:

  1. Set the window appearance to light mode.
  2. Set the window appearance to dark mode.
  3. Set the window appearance to match the system appearance.
  4. Synchronize the window appearance with the webview.
  5. Ensure compatibility with Windows 10.

After some time of trying, I think restart app is the best I can do.

Ok, thanks, I don't have a windows computer and I don't know if some of the treatments on the web work, looking forward to a better way to implement it!

ayangweb commented 1 month ago

@wyhaya I wonder if this method works? https://github.com/tauri-apps/tauri/issues/5279#issuecomment-2016500932

wyhaya commented 1 month ago

@ayangweb Invalid, it only changes the title bar, and cannot propagate it to the webview.

Document

Demo

https://github.com/wyhaya/tauri-plugin-theme/assets/23690145/40f30af9-fe87-4f19-b319-2c01c458af85

ayangweb commented 1 month ago

@ayangweb Invalid, it only changes the title bar, and cannot propagate it to the webview.

Document

Demo

Screen.Recording.2024-06-04.at.22.55.34.mov

Okay, thanks, I got it! 🥰

ayangweb commented 3 weeks ago

@wyhaya https://github.com/tauri-apps/tao/pull/937/files I'm really sorry to bother you again, this pr is the solution to the windows update theme, I wonder if it works?