mirror of
https://github.com/clash-verge-rev/clash-verge-rev
synced 2025-05-05 03:33:45 +08:00
Simplify tray icon template logic and adjust text colors
This commit is contained in:
parent
0b8d08d13b
commit
98de91771e
@ -309,13 +309,8 @@ impl Tray {
|
|||||||
|
|
||||||
let rate = rate_guard.as_ref();
|
let rate = rate_guard.as_ref();
|
||||||
let rate_bytes = SpeedRate::add_speed_text(is_custom_icon, bytes, rate).unwrap();
|
let rate_bytes = SpeedRate::add_speed_text(is_custom_icon, bytes, rate).unwrap();
|
||||||
|
|
||||||
let _ = tray.set_icon(Some(tauri::image::Image::from_bytes(&rate_bytes)?));
|
let _ = tray.set_icon(Some(tauri::image::Image::from_bytes(&rate_bytes)?));
|
||||||
if !is_custom_icon {
|
let _ = tray.set_icon_as_template(!is_custom_icon && !is_colorful);
|
||||||
let _ = tray.set_icon_as_template(!is_colorful);
|
|
||||||
} else {
|
|
||||||
let _ = tray.set_icon_as_template(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -128,16 +128,16 @@ impl SpeedRate {
|
|||||||
|
|
||||||
// 选择文本颜色
|
// 选择文本颜色
|
||||||
let (text_color, shadow_color) = if is_colorful {
|
let (text_color, shadow_color) = if is_colorful {
|
||||||
// 彩色图标使用黑色文本和轻微白色阴影
|
|
||||||
(
|
(
|
||||||
|
// Rgba([0u8, 0u8, 0u8, 255u8]),
|
||||||
|
// Rgba([255u8, 255u8, 255u8, 128u8]),
|
||||||
Rgba([255u8, 255u8, 255u8, 255u8]),
|
Rgba([255u8, 255u8, 255u8, 255u8]),
|
||||||
Rgba([0u8, 0u8, 0u8, 160u8]),
|
Rgba([0u8, 0u8, 0u8, 08u8]),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
// 单色图标使用白色文本和轻微黑色阴影
|
|
||||||
(
|
(
|
||||||
Rgba([255u8, 255u8, 255u8, 255u8]),
|
Rgba([255u8, 255u8, 255u8, 255u8]),
|
||||||
Rgba([0u8, 0u8, 0u8, 120u8]),
|
Rgba([0u8, 0u8, 0u8, 128u8]),
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
// 减小字体大小以适应文本区域
|
// 减小字体大小以适应文本区域
|
||||||
|
Loading…
x
Reference in New Issue
Block a user