Openfl._internal.renderer.dom.DOMRenderer.render()

I feel the first line of this method should read:

element.style.background = if(stage.__transparent) “transparent” else stage.__colorString;

rather than

element.style.background = stage.__colorString;

as this allows for transparency.

Regards, Jake

Have you tested it? Does that fix it?

If so, would you like to make a pull request, or should I put it in?

Thanks :smile:

(transparent stages are just uncommon :slight_smile: )

I have tested it, and yes it does work (on chrome at least).

The problem is though that many other users will now be expecting the black background that is the default, rather than the fully transparent background that will now become the default.

This code sets up the problem:

openfl.display.Stage.new(window:Window, color:Null = null)

if (color == null) {

		__transparent = true;
		this.color = 0x000000;
		
	} else {
		
		this.color = color;
		
	}

So the default is fully transparent black, but the transparent flag is being ignored in DOMRenderer.

Stage is created at

stage = new Stage (this, Reflect.hasField (config, “background”) ? config.background : 0xFFFFFF);

it would be nice to detect if “background” is is explicitly set with 8 digits rather than 6

ie 0x000000 would be opaque black
0x00000000 would be transparent black

Jake