-
Notifications
You must be signed in to change notification settings - Fork 60
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
Some text is not visible in Jupyterlab dark theme #255
Comments
Thanks @EricHUANG970823 for reporting this. @AllanJard, I confirm that I can reproduce this with the following steps
There is probably an incompatibility between the dark theme of Jupyter, and the default datatables CSS. I see the following issues:
Note that the dark mode of datatables.net doesn't have this issue. The dark mode of https://mwouts.github.io/itables/extensions.html seems to be ok too (although that the tables have a grey background there), except for SearchPanes where the panes have a white background as in Jupyter Lab with the black theme. |
I'm not sure how to tell what version of SearchBuilder is being included on the page, but it looks like it might be an old version? 1.7.1 is the current release. I haven't checked yet, but the other software such as FixedColumns might also need to be updated? |
I expect that the |
I have prepared an update, which can be tested with this link: https://mybinder.org/v2/gh/mwouts/itables/update_datatables_2.0.5?urlpath=lab/tree/docs/extensions.md, but I think it still has the same issue. I am not sure what is the best way to investigate this kind of CSS issues - is there any good tutorial out there to help me understand where that text gets its color from? |
Normally, you would right click on the element and select "Inspect" - the browser will show where the styles are coming from. If there is a difference between that and the DataTables examples, then you can compare and constract the styles applied in the two. However, Notebooks appears to hijack the right click, so you need to open the developer tools using your browser's menu (e.g. in Firefox it is the hamburger menu -> More Tools -> Web developer tools). In this case I can see the colour is coming from: In going that, I realised what was happening - DataTables' styles require that Adding that into the notebook, let's it work: |
Awesome, thanks @AllanJard for digging into this! I don't control the |
I am seeing some success with
That's a good start, however I would prefer the style to be updated too when I change the theme in Jupyter (but I am not sure how to achieve that). |
BTW it seems that the above does not address the dark mode for the documentation ( https://mwouts.github.io/itables/ ) for which the dark mode sets two data attributes |
@AllanJard , if I take a step back, I see that we had a similar issue with the search box in the past, that was initially fixed with this css from #234:
Then we transitioned to You probably see my question coming... would it be possible to adjust the extensions so that the style works well in both light and dark themes without setting the "dark" class? |
Yes, I think I basically have the same thing in the DataTables default CSS. So when I originally wrote the dark mode for DataTables I did have it just 100% determined on the end user's system preference. But that conflicted with a lot of websites which didn't have dark mode support themselves, but the user had dark mode enabled in their OS preferences. The table was virtually invisible! The solution was to use the The downside is that it does require an intervention by the dev (yourself :)) to allow dark mode to work (which I think is correct, since other parts of the site will need that support as well, as discussed above). So at the moment, no, I'm afraid if you want dark mode in DataTables there is no option but to set the |
Thanks Allan, yes no problem, I think that I can make this works in JupyterLab with e.g. this script (not sure if there is a better thing than Technically this also works for my documentation website, e.g. the background of the controls becomes dark when I switch the dark theme, but the table looks weird. That is a different issue, more related to Jupyter Book, and I will investigate it at #262. |
There must be some kind of hook or something from JupyterLab to say when the mode is changed. Or perhaps you can add an event listener on top of their own to the button used to toggle the change. Running a function every 300mS on the page isn't an optimal solution - although if there is no other choice, it might need to be that way. You might need to reach out to the JupyterLab folks to see if they fire an event or provide some other API for the mode toggle. |
Thanks Allan for your help on this! In the end I have gone for a script without |
Some text is not visible in Jupyterlab dark theme when extending the DataTables with
SearchPanes
and 'SearchBuilder'.Example.mp4
example codes:
The text was updated successfully, but these errors were encountered: