Skip to content
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

#281 - Fix dataframe rendering in dark mode #282

Merged
merged 6 commits into from
Aug 28, 2023

Conversation

Andy-Grigg
Copy link
Contributor

Fix #281

Explicitly specifies the font color in tabular cells, so that it changes correctly between light and dark themes. Also overrides the output div background color for cells that contain dataframes to transparent. Use of the :has() selector is currently not supported in Firefox - https://caniuse.com/css-has. I think we should still use it though, given that support will probably be added soon, and the use of :has() stops the changed css impacting other rendered html in a cell which may not be dark mode-aware.

Before:

image

After (Edge):

image

After (Firefox):

image

@Andy-Grigg Andy-Grigg requested a review from a team as a code owner August 28, 2023 14:18
@Andy-Grigg Andy-Grigg changed the title Fix dataframe rendering in dark mode #281 - Fix dataframe rendering in dark mode Aug 28, 2023
@github-actions github-actions bot added the bug Defects or glitches reported by users or developers label Aug 28, 2023
@Andy-Grigg
Copy link
Contributor Author

If this is merged, could a patch release be issued relatively quickly? We'd like to be able to release a new version of PyGranta BoM Analytics with this improvement without having to include this fix as custom CSS.

@Andy-Grigg
Copy link
Contributor Author

Build failure doesn't seem to be caused by these changes. It looks like it's failing because a url cannot be resolved.

@RobPasMue
Copy link
Member

@Revathyvenugopal162 - please look into the broken link issue and perform a patch release whenever you can

https://stunning-adventure-k6g9rqj.pages.github.io/active_indices.html

@RobPasMue
Copy link
Member

Issue has been solved @Andy-Grigg - @Revathyvenugopal162 please review since you are more experienced with the style

@@ -290,6 +290,10 @@ tr:nth-child(even) {
background-color: var(--pst-color-table-hover);
}

td {
Copy link
Contributor Author

@Andy-Grigg Andy-Grigg Aug 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did just have a thought. I should maybe make this more specific, something like:

div.rendered_html table.dataframe td

To try and make it only match a data cell in a dataframe, which appears in a 'rendered_html' div. Otherwise there's a risk it could change the color of other table cells.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed this improvement.

@Revathyvenugopal162
Copy link
Contributor

Thanks for solving the issue @Andy-Grigg , checked in edge and is working fine for me. feel free to merge it and i will do the patch release after that

@Andy-Grigg Andy-Grigg merged commit 4dd8a9a into main Aug 28, 2023
21 checks passed
@Andy-Grigg Andy-Grigg deleted the fix/281-dataframe-dark-mode branch August 28, 2023 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Defects or glitches reported by users or developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Odd DataFrame rendering on dark theme
3 participants