You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Jupyterlab table previews are suddenly unreadable in dark and dark-high-contrast themes. I am not sure what happened here, but I seem not to be able to revert it to showing the font in white. This might be a jupyter lab issue and not a datajoint issue.
OS: Mac OS
Jupyter lab: Version 4.2.4
Datajoint python: Version 0.14.1
I don't think 1 is worth the additional maintenance burden. 2 may be the most long-term solution, but 3 is an easier short-term solution. I lean toward 2.
Thanks @CBroz1 - could you provide a mini-tutorial here on how to do that?
Sure -
Clone this repo, do an editable install within your conda environment
cd /your/path/for/local/files
git clone https://github.com/datajoint/datajoint-python/
cd ./datajoint-python
conda activate your_env
pip install -e .
Edit the preview file to change the hex codes (e.g., #A0A0A0) of the css variable within repr_htmlhere, save the result in /you/path/for/local/files/datajoint-python/datajoint/preview.py
My `css` variable
See variables at the top. Picking colors may be easier with a color picker VSCode extension
<style type="text/css">:root { /* Variables: */--my-background-dark:#282a36;
--my-background-light:#44475a;
--my-foreground:#f8f8f2;
--my-lines:#6272a4;
--my-highlight:#bd93f9;
}
.Table{
border-collapse:collapse;
background-color:var(--my-background-dark);
color:var(--my-background-light);
}
.Tableth{ /* Table Header */background:var(--my-background-dark);
color:var(--my-background-dark);
padding:4px;
border:var(--my-lines) 1px solid;
text-align: center;
}
.Tabletd{ /* Table Data */padding:4px;
border:var(--my-lines) 1px solid; font-size:100%;
}
.Tabletr:nth-child(odd){ /* Table Row, Odd */background:var(--my-background-light);
color:var(--my-foreground);
}
.Tabletr:nth-child(even){ /* Table Row, Even */color:var(--my-foreground);
background:var(--my-background-dark);
}
/* Tooltip container */
.djtooltip {
}
/* Tooltip text */
.djtooltip .djtooltiptext {
visibility: hidden;
width:120px;
background-color:var(--my-background-light);
color:var(--my-foreground);
text-align: center;
padding:5px0;
border:1px solid var(--my-lines);
border-radius:6px;
/* Position the tooltip text - see examples below! */position: absolute;
z-index:1;
}
#primary {
font-weight: bold;
color:var(--my-highlight);
}
#nonprimary {
font-weight: normal;
color:var(--my-foreground);
}
/* Show the tooltip text when you mouse over the tooltip container */
.djtooltip:hover .djtooltiptext {
visibility: visible;
}
</style>
Activity
CBroz1 commentedon Aug 20, 2024
The html table style is defined here, hardcoded for light themes. Not ideal, but running an editable install would allow you to adjust these values
dimitri-yatsenko commentedon Aug 21, 2024
@CBroz1 what would you suggest for a better solution?
CBroz1 commentedon Aug 21, 2024
I can see a few possible paths...
Example Pandas adjustment for primary keys
I don't think 1 is worth the additional maintenance burden. 2 may be the most long-term solution, but 3 is an easier short-term solution. I lean toward 2.
horsto commentedon Jan 16, 2025
Has anybody worked on that?
Screenshot (dj vers 0.14.3)

CBroz1 commentedon Jan 17, 2025
Not that I'm aware of. I still edit the HTML of my installs for each env
horsto commentedon Jan 17, 2025
Thanks @CBroz1 - could you provide a mini-tutorial here on how to do that?
CBroz1 commentedon Jan 17, 2025
Sure -
#A0A0A0) of thecssvariable withinrepr_htmlhere, save the result in/you/path/for/local/files/datajoint-python/datajoint/preview.pyMy `css` variable
See variables at the top. Picking colors may be easier with a color picker VSCode extension
Based on dracula theme, using this color scheme
horsto commentedon Jan 17, 2025
Thanks so much @CBroz1 !
... I wish this was configurable somehow as part of dj.config (light dark switch) @dimitri-yatsenko
fix: add dark mode support for table previews in Jupyter (#1167)
fix: add dark mode support for table previews in Jupyter (#1167) (#1315)
dimitri-yatsenko commentedon Jan 9, 2026
Fixed in #1315