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
Scene.background default not null/None and None does not translate to null on the frontend #176
Comments
The current definition of |
The generated python code for Scene gives me: background = Unicode("#ffffff", allow_none=True).tag(sync=True) is that expected? |
Yes, but the JS side is wrong. I'm working on a fix. |
PS: It is a |
By the way, what are you trying to achieve by setting the background to |
If you are trying to achieve a transparent background, you will also need to set the |
Well, in ipyvolume I created my own scene, now that I'm using a scene created from pythreejs, it has a background color, which causes (I think) in one of my render passes to clear the framebuffer with a white color. Before it didn't do that, so that's why I noticed. |
Oh, you're using your own renderer, so then the pythreejs renderer is not relevant. |
@maartenbreddels Let me know if #177 fixed the problem or not! |
Yes, background is null now, but the generated code still has background's default set to '#ffffff', but you said that is expected, I don't understand why? And if the threejs docs says null is the default, shouldn't the default be None for the Python side? |
The generated code is expected based on the configuration linked. The default was set to white before I got null support, but was kept as a jupyter specific change as that is the default background color of notebooks. When set to |
I'd say, we should have a default that is transparant, so it uses the background of whatever the theme is. That would mean we'd have to have a non-default alpha=True for the Renderer .. What do you think? |
I would say transparent is a bad default:
|
Regarding the last point, see the discussions on jupyterlab repo about how MPL figures clash with lab themes. |
PS: If you want to use theme colors in widgets, I would recommend setting up a library that defines color constants based on CSS vars. These can then be dynamically calculated on the JS side. E.g.: jslink((scene, 'background'), (themecolors, '--jp_layout_color0')) |
(I'm not sure if that syntax is realizable or not) |
I'd say what seems like a good default for now, but I think that jslink example is something to think about. Maybe mention the white default in the docs, as deviating from the defaults in threejs? |
Are you saying this isn't enough? 😅 |
Ok, that will do :) |
According to the docs the default background for a Scene should be null. However, when I explicitly set it to None, it translates to sth non-null on the frontend:
The text was updated successfully, but these errors were encountered: