hue can never be exactly 360
This commit is contained in:
parent
6189810ced
commit
db41737ec7
@ -370,7 +370,7 @@ impl Color {
|
||||
|
||||
/// Create RGBA representation from HSLA values
|
||||
pub fn from_hsla(hue: Number, saturation: Number, luminance: Number, alpha: Number) -> Self {
|
||||
let mut hue = if hue > Number::from(360) {
|
||||
let mut hue = if hue >= Number::from(360) {
|
||||
hue % Number::from(360)
|
||||
} else if hue < Number::from(-360) {
|
||||
Number::from(360) + hue % Number::from(360)
|
||||
|
@ -247,6 +247,11 @@ test!(
|
||||
"a {\n color: hue(rgb(1, 0, 1));\n}\n",
|
||||
"a {\n color: 300deg;\n}\n"
|
||||
);
|
||||
test!(
|
||||
hue_of_360_becomes_0,
|
||||
"a {\n color: hue(hsl(360, 10%, 20%));\n}\n",
|
||||
"a {\n color: 0deg;\n}\n"
|
||||
);
|
||||
test!(
|
||||
hue_green_equals_blue,
|
||||
"a {\n color: hue(rgb(0, 1, 1));\n}\n",
|
||||
|
Loading…
x
Reference in New Issue
Block a user