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
Fix iframe background for dark color scheme #7821
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this correct, that dark theme text in the iframe has black color?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we don't do anything to automatically change styles within the iframe. That is something a developer would need to take care of. For example, custom components get theme information injected.
Hi @LukasMasuch This is my code:
Same issue when I try running the sample code on the document site: https://docs.streamlit.io/library/components/components-api
|
Same for me, not fixed (1.31.0 on M1 Mac in Chrome & Safari). CC @LukasMasuch |
@hoanq1811 I deployed the code here. But the issue is not reproducible for me in 1.31 (the background is transparent and not white): |
@erikvanzijst Do you have a code snippet for this to help with reproducing this issue? |
## Describe your changes I previously attempted to fix this issue in #7821. This fix worked fine, but only if the OS isn't configured to dark mode (+ Chrome). This fix sets the color scheme to `normal` to indicate that the element isn't aware of any color schemes. This seems to provide us with the desired behaviour to not automatically show a white background. ## GitHub Issue Link (if applicable) Closes #8156 Closes #7813 ## Testing Plan - The test should be fine to cover this. --- **Contribution License Agreement** By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.
* Add color scheme property to iframes * Add scheme to all iframes * Update snapshots * Migrate components e2e tests * Add snapshots
…it#8242) ## Describe your changes I previously attempted to fix this issue in streamlit#7821. This fix worked fine, but only if the OS isn't configured to dark mode (+ Chrome). This fix sets the color scheme to `normal` to indicate that the element isn't aware of any color schemes. This seems to provide us with the desired behaviour to not automatically show a white background. ## GitHub Issue Link (if applicable) Closes streamlit#8156 Closes streamlit#7813 ## Testing Plan - The test should be fine to cover this. --- **Contribution License Agreement** By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.
Describe your changes
This PR fixes an issue with iframes where the background uses white instead of transparent if a dark background is configured. This only happens in Firefox and Safari; Chrome uses the correct background.
The reason is that we recently added the
color-schema
keyword to indicate the browser if the app is in dark or light mode. But this triggers an automatic behavior where the browsers adds a white background to iframes since it assumes that the iframe can only handle a light background. We have to tell the iframe that the iframe supports bothlight
anddark
color schemes to fix this.GitHub Issue Link (if applicable)
Testing Plan
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.