From 2a7f0b6dbc221e0d6564277fbcbedc18b7392ef7 Mon Sep 17 00:00:00 2001 From: Connor Skees Date: Fri, 30 Jul 2021 06:25:12 -0400 Subject: [PATCH] support single arg special color fns --- src/builtin/functions/color/hsl.rs | 1 + src/builtin/functions/color/rgb.rs | 1 + tests/color.rs | 5 +++++ 3 files changed, 7 insertions(+) diff --git a/src/builtin/functions/color/hsl.rs b/src/builtin/functions/color/hsl.rs index 359afd5..5c3fd27 100644 --- a/src/builtin/functions/color/hsl.rs +++ b/src/builtin/functions/color/hsl.rs @@ -23,6 +23,7 @@ fn inner_hsl(name: &'static str, mut args: CallArgs, parser: &mut Parser) -> Sas if len == 1 { let mut channels = match args.get_err(0, "channels")? { Value::List(v, ..) => v, + v if v.is_special_function() => vec![v], _ => return Err(("Missing argument $channels.", args.span()).into()), }; diff --git a/src/builtin/functions/color/rgb.rs b/src/builtin/functions/color/rgb.rs index ac85b20..a359146 100644 --- a/src/builtin/functions/color/rgb.rs +++ b/src/builtin/functions/color/rgb.rs @@ -25,6 +25,7 @@ fn inner_rgb(name: &'static str, mut args: CallArgs, parser: &mut Parser) -> Sas if len == 1 { let mut channels = match args.get_err(0, "channels")? { Value::List(v, ..) => v, + v if v.is_special_function() => vec![v], _ => return Err(("Missing argument $channels.", args.span()).into()), }; diff --git a/tests/color.rs b/tests/color.rs index 0742280..562807c 100644 --- a/tests/color.rs +++ b/tests/color.rs @@ -757,6 +757,11 @@ test!( "a {\n color: hsl(1, 0.02, max(0.4));\n}\n", "a {\n color: hsl(1, 0.02, max(0.4));\n}\n" ); +test!( + hsla_special_fn_1_arg_is_not_list, + "a {\n color: hsla(var(--foo));\n}\n", + "a {\n color: hsla(var(--foo));\n}\n" +); test!( #[ignore = "we do not check if interpolation occurred"] interpolated_named_color_is_not_color,