builtin fns red
, green
, and blue
round their output
This commit is contained in:
parent
3cde25959b
commit
65f93ad6d5
@ -151,15 +151,15 @@ impl Color {
|
||||
}
|
||||
|
||||
pub fn red(&self) -> Number {
|
||||
self.rgba.red.clone()
|
||||
self.rgba.red.clone().round()
|
||||
}
|
||||
|
||||
pub fn blue(&self) -> Number {
|
||||
self.rgba.blue.clone()
|
||||
self.rgba.blue.clone().round()
|
||||
}
|
||||
|
||||
pub fn green(&self) -> Number {
|
||||
self.rgba.green.clone()
|
||||
self.rgba.green.clone().round()
|
||||
}
|
||||
|
||||
/// Mix two colors together with weight
|
||||
|
@ -603,3 +603,23 @@ test!(
|
||||
"a {\n color: #00000000f00;\n}\n",
|
||||
"a {\n color: #00000000 f00;\n}\n"
|
||||
);
|
||||
test!(
|
||||
all_three_rgb_channels_have_decimal,
|
||||
"a {\n color: rgba(1.5, 1.5, 1.5, 1);\n}\n",
|
||||
"a {\n color: #020202;\n}\n"
|
||||
);
|
||||
test!(
|
||||
builtin_fn_red_rounds_channel,
|
||||
"a {\n color: red(rgba(1.5, 1.5, 1.5, 1));\n}\n",
|
||||
"a {\n color: 2;\n}\n"
|
||||
);
|
||||
test!(
|
||||
builtin_fn_green_rounds_channel,
|
||||
"a {\n color: green(rgba(1.5, 1.5, 1.5, 1));\n}\n",
|
||||
"a {\n color: 2;\n}\n"
|
||||
);
|
||||
test!(
|
||||
builtin_fn_blue_rounds_channel,
|
||||
"a {\n color: blue(rgba(1.5, 1.5, 1.5, 1));\n}\n",
|
||||
"a {\n color: 2;\n}\n"
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user