slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
17.54k stars 600 forks source link

Settings style to material-dark in build.rs does not work #2207

Closed medhefgo closed 1 year ago

medhefgo commented 1 year ago

Setting the style to material-dark via build.rs will result in a compilation error. Other styles, including fluent-dark work as expected.

cargo generate --git https://github.com/slint-ui/slint-rust-template --name dark
cd dark/
cat <<EOF >build.rs
fn main() {
    let config = slint_build::CompilerConfiguration::new()
        .with_style("material-dark".into());
    slint_build::compile_with_config("ui/appwindow.slint", config).unwrap();
}
EOF
cargo build
ogoffart commented 1 year ago

This indeed generates a bunch of errors:

error[E0560]: struct `slint::Color` has no field named `background`
  --> /tmp/dark/target/debug/build/dark-fc4f692d8bbd118a/out/appwindow.rs:41:26
   |
41 |                          r#background : if ! true {
   |                          ^^^^^^^^^^^^ `slint::Color` does not have this field

error[E0560]: struct `slint::Color` has no field named `on_primary`
  --> /tmp/dark/target/debug/build/dark-fc4f692d8bbd118a/out/appwindow.rs:45:33
   |
45 |                          as _ , r#on_primary : if ! true {
   |                                 ^^^^^^^^^^^^ `slint::Color` does not have this field

... and more in the same style

I wonder if there is maybe a naming conflict or something.

It can also be reproduced with

SLINT_STYLE=material-dark cargo run -p gallery

material-light has the same problem, but strangely not material