diff --git a/color.rs b/color.rs index 7338a6ac..9c05eabe 100644 --- a/color.rs +++ b/color.rs @@ -297,9 +297,9 @@ fn parse_color_function(name: &str, arguments: &[ComponentValue]) let hue = expect_number!() / 360.; let hue = hue - hue.floor(); expect_comma!(); - let saturation = (expect_percentage!() / 100.).min(0.).max(1.); + let saturation = (expect_percentage!() / 100.).max(0.).min(1.); expect_comma!(); - let lightness = (expect_percentage!() / 100.).min(0.).max(1.); + let lightness = (expect_percentage!() / 100.).max(0.).min(1.); // http://www.w3.org/TR/css3-color/#hsl-color fn hue_to_rgb(m1: f64, m2: f64, mut h: f64) -> f64 { @@ -321,7 +321,7 @@ fn parse_color_function(name: &str, arguments: &[ComponentValue]) let alpha = if has_alpha { expect_comma!(); - (expect_number!()).min(0.).max(1.) as f32 + (expect_number!()).max(0.).min(1.) as f32 } else { 1. };