Repository: aome510/spotify-player (language: rust)

Issue:
Themed image border background
**Describe the bug**
Visual bug where the background rectangle of the image is black instead of the background color defined in the theme, when the `cover_img_scale` config is less than 1.

**To Reproduce**
Set `cover_img_scale` to a value smaller than one in the `app.toml` config file.

**Expected behaviour**
It would look nicer if the border around the image (see right and bottom border in the screenshot) were the theme's background color instead of black.

**Log and backtrace**
/

**Screenshots**
![image](https://github.com/user-attachments/assets/2f4b6855-fce4-4aec-9dea-6360014e98c6)


**Environment**

- OS: Linux
- Application version: 0.20.1
- Application features: image



Discussion / hints:

Fix patch:
diff --git a/spotify_player/src/ui/playback.rs b/spotify_player/src/ui/playback.rs
index 4931eb6b..6095b4b3 100644
--- a/spotify_player/src/ui/playback.rs
+++ b/spotify_player/src/ui/playback.rs
@@ -82,8 +82,12 @@ pub fn render_playback_window(
                             if needs_clear {
                                 // clear the image's both new and old areas to ensure no remaining artifacts before rendering the image
                                 // See: https://github.com/aome510/spotify-player/issues/389
-                                clear_area(frame, ui.last_cover_image_render_info.render_area);
-                                clear_area(frame, cover_img_rect);
+                                clear_area(
+                                    frame,
+                                    ui.last_cover_image_render_info.render_area,
+                                    &ui.theme,
+                                );
+                                clear_area(frame, cover_img_rect, &ui.theme);
                             } else {
                                 if !ui.last_cover_image_render_info.rendered {
                                     if let Err(err) = render_playback_cover_image(state, ui) {
@@ -144,7 +148,11 @@ pub fn render_playback_window(
         #[cfg(feature = "image")]
         {
             if ui.last_cover_image_render_info.rendered {
-                clear_area(frame, ui.last_cover_image_render_info.render_area);
+                clear_area(
+                    frame,
+                    ui.last_cover_image_render_info.render_area,
+                    &ui.theme,
+                );
                 ui.last_cover_image_render_info = ImageRenderInfo::default();
             }
         }
@@ -164,14 +172,15 @@ pub fn render_playback_window(
 }
 
 #[cfg(feature = "image")]
-fn clear_area(frame: &mut Frame, rect: Rect) {
+fn clear_area(frame: &mut Frame, rect: Rect, theme: &config::Theme) {
     for x in rect.left()..rect.right() {
         for y in rect.top()..rect.bottom() {
             frame
                 .buffer_mut()
                 .cell_mut((x, y))
                 .expect("invalid cell")
-                .reset();
+                .set_char(' ')
+                .set_style(theme.app());
         }
     }
 }
@@ -373,6 +382,7 @@ fn render_playback_cover_image(state: &SharedState, ui: &mut UIStateGuard) -> Re
                 width: Some(width),
                 height: Some(height),
                 restore_cursor: true,
+                transparent: true,
                 ..Default::default()
             },
         )


Test patch: