From a1b1bb01ffca66f12c6b9fe189df4cc00a8d2e3c Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Fri, 2 Aug 2019 12:56:10 +0200 Subject: [PATCH] backlight: Draw container box around bar --- src/backlight.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/backlight.rs b/src/backlight.rs index ab80ae2..e2a2a7b 100644 --- a/src/backlight.rs +++ b/src/backlight.rs @@ -1,6 +1,6 @@ use crate::buffer::Buffer; use crate::color::Color; -use crate::draw::{draw_bar, draw_text, ROBOTO_REGULAR}; +use crate::draw::{draw_bar, draw_text, draw_box, ROBOTO_REGULAR}; use crate::module::{Input, ModuleImpl}; use std::fs::OpenOptions; @@ -102,21 +102,27 @@ impl ModuleImpl for Backlight { _time: &DateTime, ) -> Result, Error> { buf.memset(bg); + let c = Color::new(1.0, 1.0, 1.0, 1.0); draw_text( ROBOTO_REGULAR, &mut buf.subdimensions((0, 0, 128, 24)), bg, - &Color::new(1.0, 1.0, 1.0, 1.0), + &c, 24.0, "backlight", )?; draw_bar( - &mut buf.subdimensions((128, 0, 384, 24)), - &Color::new(1.0, 1.0, 1.0, 1.0), - 384, + &mut buf.subdimensions((128, 0, 432, 24)), + &c, + 432, 24, self.brightness() / 100.0, )?; + draw_box( + &mut buf.subdimensions((128, 0, 432, 24)), + &c, + (432, 24), + )?; Ok(vec![buf.get_signed_bounds()]) }