support single arg special color fns

This commit is contained in:
Connor Skees 2021-07-30 06:25:12 -04:00
parent 1e2e32140b
commit 2a7f0b6dbc
3 changed files with 7 additions and 0 deletions

View File

@ -23,6 +23,7 @@ fn inner_hsl(name: &'static str, mut args: CallArgs, parser: &mut Parser) -> Sas
if len == 1 { if len == 1 {
let mut channels = match args.get_err(0, "channels")? { let mut channels = match args.get_err(0, "channels")? {
Value::List(v, ..) => v, Value::List(v, ..) => v,
v if v.is_special_function() => vec![v],
_ => return Err(("Missing argument $channels.", args.span()).into()), _ => return Err(("Missing argument $channels.", args.span()).into()),
}; };

View File

@ -25,6 +25,7 @@ fn inner_rgb(name: &'static str, mut args: CallArgs, parser: &mut Parser) -> Sas
if len == 1 { if len == 1 {
let mut channels = match args.get_err(0, "channels")? { let mut channels = match args.get_err(0, "channels")? {
Value::List(v, ..) => v, Value::List(v, ..) => v,
v if v.is_special_function() => vec![v],
_ => return Err(("Missing argument $channels.", args.span()).into()), _ => return Err(("Missing argument $channels.", args.span()).into()),
}; };

View File

@ -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",
"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!( test!(
#[ignore = "we do not check if interpolation occurred"] #[ignore = "we do not check if interpolation occurred"]
interpolated_named_color_is_not_color, interpolated_named_color_is_not_color,