From 0ddabb5afdc43c9f56b6360f0be2e42a922cd2f8 Mon Sep 17 00:00:00 2001 From: ConnorSkees <39542938+ConnorSkees@users.noreply.github.com> Date: Tue, 7 Apr 2020 00:04:19 -0400 Subject: [PATCH] hsl/hsla 4 args special functions --- src/builtin/color/hsl.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/builtin/color/hsl.rs b/src/builtin/color/hsl.rs index c6dabad..e5be15f 100644 --- a/src/builtin/color/hsl.rs +++ b/src/builtin/color/hsl.rs @@ -117,6 +117,12 @@ pub(crate) fn register(f: &mut HashMap) { format!("$alpha: Expected {} to have no units or \"%\".", v).into() ) } + v if v.is_special_function() => { + return Ok(Value::Ident( + format!("hsl({}, {}, {}, {})", hue, saturation, lightness, v), + QuoteKind::None, + )); + } v => return Err(format!("$alpha: {} is not a number.", v).into()), }; Ok(Value::Color(Color::from_hsla( @@ -233,6 +239,12 @@ pub(crate) fn register(f: &mut HashMap) { format!("$alpha: Expected {} to have no units or \"%\".", v).into() ) } + v if v.is_special_function() => { + return Ok(Value::Ident( + format!("hsl({}, {}, {}, {})", hue, saturation, lightness, v), + QuoteKind::None, + )); + } v => return Err(format!("$alpha: {} is not a number.", v).into()), }; Ok(Value::Color(Color::from_hsla(