Linux Chromium - transparent background

1,427 views
Skip to first unread message

Dan Montz

unread,
Oct 21, 2017, 11:10:13 AM10/21/17
to Chromium-discuss
I have been searching the web for a way to get a transparent background using Chromium running on Linux.  Most of the posts are over 5 years old and any code snippet that is shown is not present in the latest Chromium code.  I have been digging through the Chromium code and have made some slight modifications to get a window created with a depth of 32, but the rendered HTML is always over a white background.

Here is my HTML:
<!DOCTYPE html>
<html>
<head>
</head>
<body style="background-color: rgba(80,80,80,0.25)">
<div style="width: 100px; height: 100px; background: rgba(255,0,0,1.0);"></div>
<div style="width: 100px; height: 100px; background: rgba(255,0,0,0.75);"></div>
<div style="width: 100px; height: 100px; background: rgba(255,0,0,0.5);"></div>
<div style="width: 100px; height: 100px; background: rgba(255,0,0,0.25);"></div>
</body>
</html>

Does anyone know if Chromium running on Linux can support a transparent background (ie I want to be able to see the background through the browser window).

Thanks in advance!

Dan Montz

unread,
Nov 28, 2017, 4:55:53 PM11/28/17
to Chromium-discuss
After further investigation, I found that by modifying the XVisualManager::ChooseVisualForWindow() code slightly, I was able to get a transparent background.  These changes seem really hacky and with all of the chatter on the forums, I feel like I am missing something.  If anyone has knowledge in this area, please reply.

For those interested, the changes were:
1.  force use_argb = true; after the declaration line and code.
2.  force visual_id = transparent_visual_id_ after the declaration and code.

I need this capability for an embedded linux project.  The ARGB image will be overlaid on video so the transparent background is required.

Again, any help is greatly appreciated!

Thomas Scheuermann

unread,
Jan 19, 2018, 4:42:39 PM1/19/18
to Chromium-discuss
Hello Dan,

did you make any progress with your transparent background?
I've tried the changes you made but I couldn't get a transparent background.
Should this work with the html code of the first post or did you do anything else to get the transparent background.

Regards,
Thomas
Reply all
Reply to author
Forward
0 new messages