Removing Black Background from Image Widget in OpenHAB

I’ve been working on customizing my OpenHAB dashboard recently, and I stumbled upon an issue that I thought I’d share with the community. I was trying to display a camera feed on my 7-inch Kindle dashboard, but no matter what I did, there was this persistent black background that just wouldn’t go away. It was pretty frustrating because all I wanted was the greenish section background to show through.

I started by looking at the code I had in place. The image was loaded using an API call, and I had added some inline styles to try and set the background color to transparent. Here’s what I had initially:

html

I tried using ng-style as well, but nothing seemed to work. I even looked into the matrix-theme by Patrick and adapted some code from Michael Stjerna, but the black background was still there. I was starting to think it might be a bug or something missing in the widget itself.

After some research and trial and error, I finally found a solution that worked for me. It turns out that the image widget itself wasn’t the issue, but rather how the styles were being applied. I ended up modifying the HTML structure and CSS classes to ensure the background was properly set to transparent. Here’s what I ended up with:

html

And I added the following CSS to my theme:

css
.camera-feed {
background-color: transparent;
}

.transparent-bg {
background-color: transparent !important;
}

This finally did the trick! The black background was gone, and only the greenish section background was visible, just like I wanted. It was a bit of a journey, but I’m glad I figured it out. I hope this helps someone else who’s running into the same issue. If you have any other tips or tricks for customizing dashboards, I’d love to hear them!

Cheers,
[Your Name]