mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 10:50:00 +00:00
feat: color: add channel properties to color
Add extra properties to the `color` type. - `red` - `green` - `blue` - `alpha`
This commit is contained in:
parent
0409cb0140
commit
8c60cc74be
8 changed files with 73 additions and 3 deletions
|
@ -3048,6 +3048,9 @@ fn compile_builtin_function_call(
|
|||
ctx.generator_state.conditional_includes.cstdlib.set(true);
|
||||
format!("[](const auto &a){{ auto e1 = std::end(a); auto e2 = const_cast<char*>(e1); auto r = std::strtod(std::begin(a), &e2); return e1 == e2 ? r : 0; }}({})", a.next().unwrap())
|
||||
}
|
||||
BuiltinFunction::ColorRgbaStruct => {
|
||||
format!("{}.to_argb_u8()", a.next().unwrap())
|
||||
}
|
||||
BuiltinFunction::ColorBrighter => {
|
||||
format!("{}.brighter({})", a.next().unwrap(), a.next().unwrap())
|
||||
}
|
||||
|
|
|
@ -2492,6 +2492,7 @@ fn compile_builtin_function_call(
|
|||
quote!(#(#a)*.as_str().parse::<f64>().unwrap_or_default())
|
||||
}
|
||||
BuiltinFunction::StringIsFloat => quote!(#(#a)*.as_str().parse::<f64>().is_ok()),
|
||||
BuiltinFunction::ColorRgbaStruct => quote!( #(#a)*.to_argb_u8()),
|
||||
BuiltinFunction::ColorBrighter => {
|
||||
let x = a.next().unwrap();
|
||||
let factor = a.next().unwrap();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue