mux: make tardy/greyed out palette less jarring

Use a similar hsv transformation to that used to dim inactive panes
instead of the treatment that made the black look grey, which felt
like a flash instead of a dim.
This commit is contained in:
Wez Furlong committed 2021-05-30 08:13:33 -07:00
1 parent 564b4563b3
commit 46d4de7ad2
1 file changed
+4 -4
+4 -4
View File
@@ -35,15 +35,15 @@ pub struct ColorPalette {
/// This is not defined on RgbColor itself in order
/// to avoid termwiz requiring a dep on the palette crate.
fn grey_out(color: RgbColor) -> RgbColor {
use palette::{Blend, Lch, Saturate, Srgba};
use palette::{Lch, Saturate, Srgba};
let color = Srgba::new(color.red, color.green, color.blue, 0xff);
let color: Srgba = color.into_format();
let color = color.into_linear();
let desaturated = Lch::from(color).desaturate(0.2);
let mut desaturated = Lch::from(color).desaturate(0.2);
desaturated.l *= 0.8;
let tint = Srgba::new(0.2, 0.2, 0.2, 0.6).into_linear();
let result = Srgba::from_linear(tint.over(desaturated.into()));
let result = Srgba::from_linear(desaturated.into());
let result = Srgba::<u8>::from_format(result);
RgbColor::new(result.red, result.green, result.blue)