azul_native_style/
lib.rs

1//! Provides azul-compatible approximations of OS-native styles.
2
3extern crate azul_css;
4extern crate azul_css_parser;
5
6use azul_css::Css;
7
8/// CSS mimicking the OS-native look - Windows: `styles/native_windows.css`
9pub const WINDOWS_CSS: &str = concat!(
10    include_str!("styles/native_windows.css"),
11    include_str!("styles/shared/table.css"),
12);
13
14/// CSS mimicking the OS-native look - Linux: `styles/native_linux.css`
15pub const LINUX_CSS: &str = concat!(
16    include_str!("styles/native_linux.css"),
17    include_str!("styles/shared/table.css"),
18);
19
20/// CSS mimicking the OS-native look - Mac: `styles/native_macos.css`
21pub const MACOS_CSS: &str = concat!(
22    include_str!("styles/native_macos.css"),
23    include_str!("styles/shared/table.css"),
24);
25
26/// CSS mimicking the OS-native look - Web: `styles/native_web.css`
27pub const WASM_CSS: &str = concat!(
28    include_str!("styles/native_web.css"),
29    include_str!("styles/shared/table.css"),
30);
31
32#[cfg(target_os="windows")]
33pub const NATIVE_CSS: &str = WINDOWS_CSS;
34#[cfg(target_os="macos")]
35pub const NATIVE_CSS: &str = MACOS_CSS;
36#[cfg(target_os="linux")]
37pub const NATIVE_CSS: &str = LINUX_CSS;
38#[cfg(target_arch="wasm32")]
39pub const NATIVE_CSS: &str = WASM_CSS;
40
41/// Returns the native style for the OS
42///
43/// TODO: Use OS version / load system style here!
44pub fn native() -> Css {
45    azul_css_parser::new_from_str(NATIVE_CSS).unwrap()
46}