Make color.components' alpha parameter named (#2734)

This commit is contained in:
frozolotl 2023-11-21 18:05:12 +01:00 committed by GitHub
parent 36c7301608
commit 55799f7395
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -702,6 +702,7 @@ impl Color {
pub fn components(
self,
/// Whether to include the alpha component.
#[named]
#[default(true)]
alpha: bool,
) -> Array {

View File

@ -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%))