docs.rs failed to build tauri-plugin-theme-2.1.2
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build:
tauri-plugin-theme-1.0.0
tauri-plugin-theme
Tauri currently doesn't support dynamically change app theme, this plugin makes up for that.
https://github.com/wyhaya/tauri-plugin-theme/assets/23690145/2422ce95-418d-4f07-adf5-e78af2552f51
[!NOTE]
This only applies to theTauri 2x
version. If you are using the Tauri 1x version, please refer to tauri-1x-version.
Install
let mut ctx = generate_context!;
default
// Init plugin and auto restore window theme !!!
.plugin
// ...
.run
// ...
Tauri permissions
Add to src-tauri/capabilities/default.json
{
...
"permissions": [
...
"theme:default"
]
}
Usage
// Follow system theme setting
;
// Always use light theme
;
// Always use dark theme
;
// Get saved theme (default: auto)
const theme = await ;
When you call set_theme
, the theme will be auto saved, and it will be restored auto after the App restart.
Support
MacOS | Linux | Windows | Android | iOS |
---|---|---|---|---|
✅ | ✅ | ✅ | ❌ | ❌ |
NOTE
For Windows
Requires WebView2 Runtime version 101.0.1210.39(May 9, 2022) or higher; otherwise, the app will complete the theme change by restart
.
For Linux
On Linux platform, it has not been extensively tested.