From 55799f73952f66b937a75f5e7f99604987238399 Mon Sep 17 00:00:00 2001 From: frozolotl <44589151+frozolotl@users.noreply.github.com> Date: Tue, 21 Nov 2023 18:05:12 +0100 Subject: [PATCH] Make `color.components`' alpha parameter named (#2734) --- crates/typst/src/geom/color.rs | 1 + tests/typ/compiler/methods.typ | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/typst/src/geom/color.rs b/crates/typst/src/geom/color.rs index 247b424bc..3f5ef479f 100644 --- a/crates/typst/src/geom/color.rs +++ b/crates/typst/src/geom/color.rs @@ -702,6 +702,7 @@ impl Color { pub fn components( self, /// Whether to include the alpha component. + #[named] #[default(true)] alpha: bool, ) -> Array { diff --git a/tests/typ/compiler/methods.typ b/tests/typ/compiler/methods.typ index 4c4837869..bd38bbd4f 100644 --- a/tests/typ/compiler/methods.typ +++ b/tests/typ/compiler/methods.typ @@ -122,7 +122,7 @@ #test(luma(40).to-hex(), "#282828") #test-repr(cmyk(4%, 5%, 6%, 7%).to-hex(), "#e4e1df") #test-repr(rgb(cmyk(4%, 5%, 6%, 7%)).components(), (89.28%, 88.35%, 87.42%, 100%)) -#test-repr(rgb(luma(40%)).components(false), (40%, 40%, 40%)) +#test-repr(rgb(luma(40%)).components(alpha: false), (40%, 40%, 40%)) #test-repr(cmyk(luma(40)).components(), (11.76%, 10.67%, 10.51%, 14.12%)) #test-repr(cmyk(rgb(1, 2, 3)), cmyk(66.67%, 33.33%, 0%, 98.82%)) #test-repr(luma(rgb(1, 2, 3)), luma(0.73%))