A Tauri plugin to get the system accent color for macOS
# Cargo.toml
[dependencies]
tauri-plugin-accent-color = { git = "https://github.com/freethinkel/tauri-plugin-accent-color" }
// package.json
"dependencies": {
"tauri-plugin-accent-color": "git+https://github.com/freethinkel/tauri-plugin-accent-color"
}
// src-tauri/lib.rs
use tauri_plugin_accent_color;
pub fn run() {
tauri::Builder::default()
.plugin(tauri_plugin_accent_color::init())
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
import { accentColor } from "tauri-plugin-accent-color";
console.log(accentColor.get());
accentColor.subscribe((color) => {
document.documentElement.style.setProperty("--color-accent", color);
});
git clone https://github.com/freethinkel/tauri-plugin-accent-color
cd tauri-plugin-accent-color/example/tauri-app
npm install
npm run tauri dev