mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-05-16 12:47:09 +02:00
Merge branch 'theme-plugins'
# Conflicts: # packages/plugin-runtime-types/src/bindings/gen_events.ts
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@yaakapp/api",
|
"name": "@yaakapp/api",
|
||||||
"version": "0.6.5",
|
"version": "0.6.6",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"api-client",
|
"api-client",
|
||||||
"insomnia-alternative",
|
"insomnia-alternative",
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
|
|
||||||
package yaak.plugins.runtime;
|
|
||||||
|
|
||||||
service PluginRuntime {
|
|
||||||
rpc EventStream (stream EventStreamEvent) returns (stream EventStreamEvent);
|
|
||||||
}
|
|
||||||
|
|
||||||
message EventStreamEvent {
|
|
||||||
string event = 1;
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
use tauri::{Runtime, Window, command};
|
use log::warn;
|
||||||
|
use tauri::{command, Runtime, Window};
|
||||||
|
|
||||||
#[command]
|
#[command]
|
||||||
pub(crate) fn set_title<R: Runtime>(window: Window<R>, title: &str) {
|
pub(crate) fn set_title<R: Runtime>(window: Window<R>, title: &str) {
|
||||||
@@ -23,7 +24,7 @@ pub(crate) fn set_theme<R: Runtime>(window: Window<R>, bg_color: &str) {
|
|||||||
crate::mac::update_window_theme(window, color);
|
crate::mac::update_window_theme(window, color);
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
log::warn!("Failed to parse background color '{}': {}", bg_color, err)
|
warn!("Failed to parse background color '{}': {}", bg_color, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ pub(crate) fn update_window_theme<R: Runtime>(window: Window<R>, color: Color) {
|
|||||||
NSAppearance, NSAppearanceNameVibrantDark, NSAppearanceNameVibrantLight, NSWindow,
|
NSAppearance, NSAppearanceNameVibrantDark, NSAppearanceNameVibrantLight, NSWindow,
|
||||||
};
|
};
|
||||||
|
|
||||||
let brightness = (color.r as u64 + color.g as u64 + color.b as u64) / 3;
|
let brightness = (color.r as f64 + color.g as f64 + color.b as f64) / 3.0;
|
||||||
let label = window.label().to_string();
|
let label = window.label().to_string();
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
@@ -49,7 +49,7 @@ pub(crate) fn update_window_theme<R: Runtime>(window: Window<R>, color: Color) {
|
|||||||
let _ = window.run_on_main_thread(move || {
|
let _ = window.run_on_main_thread(move || {
|
||||||
let handle = window_handle;
|
let handle = window_handle;
|
||||||
|
|
||||||
let selected_appearance = if brightness >= 128 {
|
let selected_appearance = if brightness >= 0.5 {
|
||||||
NSAppearance(NSAppearanceNameVibrantLight)
|
NSAppearance(NSAppearanceNameVibrantLight)
|
||||||
} else {
|
} else {
|
||||||
NSAppearance(NSAppearanceNameVibrantDark)
|
NSAppearance(NSAppearanceNameVibrantDark)
|
||||||
|
|||||||
Reference in New Issue
Block a user