mirror of
https://github.com/hulthe/inkopslista.git
synced 2026-08-03 23:11:28 +02:00
Detect dark mode when running in browser
This commit is contained in:
+11
-1
@@ -1,4 +1,14 @@
|
||||
use std::env;
|
||||
|
||||
fn main() {
|
||||
let config = slint_build::CompilerConfiguration::new().with_style("cosmic-dark".into());
|
||||
let target_arch = env::var("CARGO_CFG_TARGET_ARCH").expect("target arch env");
|
||||
let style = match target_arch.as_str() {
|
||||
// For web, rely on dark mod detection based on browser settings.
|
||||
"wasm32" => "cosmic",
|
||||
|
||||
// For any other target, force dark mode.
|
||||
_ => "cosmic-dark",
|
||||
};
|
||||
let config = slint_build::CompilerConfiguration::new().with_style(style.into());
|
||||
slint_build::compile_with_config("ui/app.slint", config).expect("Slint build failed");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user