]> git.seodisparate.com - mpd_info_screen/commitdiff
Impl setting opacity of text bg via arg
authorStephen Seo <seo.disparate@gmail.com>
Wed, 10 Aug 2022 05:05:39 +0000 (14:05 +0900)
committerStephen Seo <seo.disparate@gmail.com>
Wed, 10 Aug 2022 05:05:39 +0000 (14:05 +0900)
src/display.rs
src/main.rs

index 26fa5c65c2e6cd2a884a20bd89e853e5e3ac3261..b15193691832ad221b8aa197be7351b244219e21 100644 (file)
@@ -619,7 +619,7 @@ impl MPDDisplay {
                     w: filename_dimensions.w,
                     h: filename_dimensions.h,
                 },
-                Color::from_rgba(0, 0, 0, 160),
+                Color::from_rgba(0, 0, 0, self.opts.text_bg_opacity),
             )?;
         }
         if !self.opts.disable_show_album {
@@ -631,7 +631,7 @@ impl MPDDisplay {
                     w: album_dimensions.w,
                     h: album_dimensions.h,
                 },
-                Color::from_rgba(0, 0, 0, 160),
+                Color::from_rgba(0, 0, 0, self.opts.text_bg_opacity),
             )?;
         }
         if !self.opts.disable_show_artist {
@@ -643,7 +643,7 @@ impl MPDDisplay {
                     w: artist_dimensions.w,
                     h: artist_dimensions.h,
                 },
-                Color::from_rgba(0, 0, 0, 160),
+                Color::from_rgba(0, 0, 0, self.opts.text_bg_opacity),
             )?;
         }
         if !self.opts.disable_show_title {
@@ -655,7 +655,7 @@ impl MPDDisplay {
                     w: title_dimensions.w,
                     h: title_dimensions.h,
                 },
-                Color::from_rgba(0, 0, 0, 160),
+                Color::from_rgba(0, 0, 0, self.opts.text_bg_opacity),
             )?;
         }
         let mesh: Mesh = mesh_builder
@@ -667,7 +667,7 @@ impl MPDDisplay {
                     w: timer_dimensions.w,
                     h: timer_dimensions.h,
                 },
-                Color::from_rgba(0, 0, 0, 160),
+                Color::from_rgba(0, 0, 0, self.opts.text_bg_opacity),
             )?
             .build(ctx)?;
 
index 9737fa6b77a58f9d2c2e15d859bde5df4a54a1bf..51f02016221ffd1e74460fa636abd7f015f5d8bc 100644 (file)
@@ -49,6 +49,13 @@ pub struct Opt {
         case_insensitive = true,
     )]
     log_level: debug_log::LogLevel,
+    #[structopt(
+        short,
+        long,
+        help = "sets the opacity of the text background (0-255)",
+        default_value = "190"
+    )]
+    text_bg_opacity: u8,
 }
 
 fn main() -> Result<(), String> {