From 2036116f169369e31f4fd8a280788c4267a7024b Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Thu, 1 Feb 2024 18:53:45 +0400 Subject: config: Premultiply alpha in Color when converting to f32 Smithay wants premultiplied alpha. --- niri-config/src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/niri-config/src/lib.rs b/niri-config/src/lib.rs index 736f976e..f00eed9c 100644 --- a/niri-config/src/lib.rs +++ b/niri-config/src/lib.rs @@ -348,7 +348,8 @@ impl Color { impl From for [f32; 4] { fn from(c: Color) -> Self { - [c.r, c.g, c.b, c.a].map(|x| x as f32 / 255.) + let [r, g, b, a] = [c.r, c.g, c.b, c.a].map(|x| x as f32 / 255.); + [r * a, g * a, b * a, a] } } -- cgit