-
Notifications
You must be signed in to change notification settings - Fork 85
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
Jupyterlab shows tables in black on black #1167
Comments
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 |
@CBroz1 what would you suggest for a better solution? |
I can see a few possible paths...
Example Pandas adjustment for primary keysimport pandas as pd
from IPython.display import display
data = {
'id': [1, 2, 3],
'name': ['Alice', 'Bob', 'Charlie'],
'age': [24, 27, 22],
'email': ['[email protected]', '[email protected]', '[email protected]']
}
df = pd.DataFrame(data)
primary_key_cols = ['id', 'name']
def style_primary_keys(df, primary_key_cols):
styled_cols = {col: f"*{col}" if col in primary_key_cols else col for col in df.columns}
df = df.rename(columns=styled_cols)
return df
styled_df = style_primary_keys(df, primary_key_cols)
display(styled_df.style) 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. |
Not that I'm aware of. I still edit the HTML of my installs for each env |
Thanks @CBroz1 - could you provide a mini-tutorial here on how to do that? |
Sure -
cd /your/path/for/local/files
git clone https://github.com/datajoint/datajoint-python/
cd ./datajoint-python
conda activate your_env
pip install -e .
My `css` variableSee 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);
}
.Table th{ /* Table Header */
background: var(--my-background-dark);
color: var(--my-background-dark);
padding: 4px;
border: var(--my-lines) 1px solid;
text-align: center;
}
.Table td{ /* Table Data */
padding:4px;
border:var(--my-lines) 1px solid; font-size:100%;
}
.Table tr:nth-child(odd){ /* Table Row, Odd */
background: var(--my-background-light);
color: var(--my-foreground);
}
.Table tr: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: 5px 0;
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> Based on dracula theme, using this color scheme
|
Thanks so much @CBroz1 ! ... I wish this was configurable somehow as part of dj.config (light dark switch) @dimitri-yatsenko |
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
The text was updated successfully, but these errors were encountered: