-
Notifications
You must be signed in to change notification settings - Fork 819
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Opacity/transparency issues with overlapped widgets #3676
Comments
Thanks @rodrigogiraoserrao for checking all these scenarios. After looking at this again , it seems only the This probably isn't helpful given the significant changes in #2814, but making a note just in case. EDIT: Digging deeper, actually only |
Confirmed this is still broken on MRE without external CSS file: from textual.app import App
from textual.widgets import Label
class BGApp(App):
CSS = """\
Screen {
layers: below above;
}
#below {
width: 30;
height: 5;
layer: below;
background: blue;
}
#above {
width: 20;
height: 3;
layer: above;
background: red 0%;
}
"""
def compose(self):
yield Label("below", id="below")
yield Label("above", id="above")
if __name__ == "__main__":
BGApp().run() |
I believe this is impacting dialogs being able to have transparency in portions of their bodies as well. I attempted to dig into this a bit, in order to try to narrow it down and help prevent similar issues with transparent portions of dialogs only showing black. Having 0 experience with the backend rendering system in Textual, it led to a lot of questions as I poked around, so I couldn't quite pinpoint it. What I did find however is that is seems to be related to either:
I attempted a lot of fairly hacking poking trying to figure it out, such as creating a custom Compositor for Screens. The modification to _arrange_root may not be needed, but I think a long term solution might, since without it the visible widgets in the screen do not contain the items in the background. Maybe BackgroundScreen is suppose to prevent the need for this, but I am not sure that widgets in a screen/layer have visibility to the styles of widgets behind them without it. If I skipped the "render_lines" call for base widgets in screens, then I did see the expected widgets behind rendering as expected (so I at least can "confirm" they are not cropping out portions).
I also checked the styles to ensure they show alpha values correctly, but it appears they just can't seem to pull what the values/lines are from behind them when transparent. Maybe this has more to do with how it is creating chops though in Compositors, but I can't be certain since this was my first deep dive into the rendering logic. Hoping this might be able to at least help speed up future investigations. Not sure when/if I will have time to dig into it again to try to provide a more concrete cause. |
This change [to how opacity works] might have inadvertently introduced a bug for layers with opacity. Here's a simple example adapted from the docs for Layers, with a binding that changes the opacity of
#box1
.Before v0.29.0
After v0.29.0
Excerpt of a comment posted by @TomJGooding in #3652 (comment)
The text was updated successfully, but these errors were encountered: