feat: color: add channel properties to color

Add extra properties to the `color` type.
- `red`
- `green`
- `blue`
- `alpha`
This commit is contained in:
Luke D. Jones 2024-03-05 17:37:22 +13:00 committed by Olivier Goffart
parent 0409cb0140
commit 8c60cc74be
8 changed files with 73 additions and 3 deletions

View file

@ -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())
}