ce27a0c35d
将桌面壳 WebView 职责拆分为运行态、URL、导航、网络、生命周期、拖拽和事件模块 更新三端桥接层结构门禁清单 同步宿主壳文档和共享记忆中的桌面壳模块口径
33 lines
706 B
Rust
33 lines
706 B
Rust
use tauri::Theme;
|
|
|
|
pub(crate) fn desktop_platform() -> &'static str {
|
|
if cfg!(target_os = "macos") {
|
|
"macos"
|
|
} else if cfg!(target_os = "windows") {
|
|
"windows"
|
|
} else if cfg!(target_os = "linux") {
|
|
"linux"
|
|
} else {
|
|
"unknown"
|
|
}
|
|
}
|
|
|
|
pub(crate) fn color_scheme_from_theme(theme: Theme) -> &'static str {
|
|
match theme {
|
|
Theme::Light => "light",
|
|
Theme::Dark => "dark",
|
|
_ => "unknown",
|
|
}
|
|
}
|
|
|
|
#[cfg(test)]
|
|
mod tests {
|
|
use super::*;
|
|
|
|
#[test]
|
|
fn color_scheme_maps_window_theme() {
|
|
assert_eq!(color_scheme_from_theme(Theme::Light), "light");
|
|
assert_eq!(color_scheme_from_theme(Theme::Dark), "dark");
|
|
}
|
|
}
|