kael 0.2.0

GPU-accelerated native UI framework for Rust — build desktop apps with Metal, DirectX, and Vulkan rendering
Documentation
use crate::WindowAppearance;
use objc2::runtime::AnyObject;
use objc2_app_kit::NSAppearance;

#[allow(non_camel_case_types)]
type id = *mut AnyObject;

impl WindowAppearance {
    pub(crate) unsafe fn from_native(appearance: id) -> Self {
        let appearance: &NSAppearance = unsafe { &*(appearance as *const NSAppearance) };
        let name = appearance.name().to_string();
        match name.as_str() {
            "NSAppearanceNameVibrantLight" => Self::VibrantLight,
            "NSAppearanceNameVibrantDark" => Self::VibrantDark,
            "NSAppearanceNameAqua" => Self::Light,
            "NSAppearanceNameDarkAqua" => Self::Dark,
            other => {
                println!("unknown appearance: {other}");
                Self::Light
            }
        }
    }
}