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

Dark theme-friendly HTML Dataset and DataArray reprs for jupyter notebooks? #4161

Closed
lukelbd opened this issue Jun 16, 2020 · 2 comments
Closed

Comments

@lukelbd
Copy link

lukelbd commented Jun 16, 2020

Xarray's HTML Dataset and DataArray reprs are evidently not compatible with "dark" jupyter notebook themes. They seem to work fine with the dark jupyter lab theme, and since jupyter lab is the way of the future perhaps this issue is obsolete, but thought I'd mention it.

The below example is from a jupyter notebook with the "onedork" dark theme from jupyter-themes. It results in black text against a dark background for the section headers (Coordinates, Dimensions, etc.) and DataArray data tables, and a light background for the coordinate and Dataset data tables.

# Dataset repr
import numpy as np
import xarray as xr
ds = xr.Dataset(
    {
        'temp': (('x', 'y'), np.random.rand(10, 20), {'long_name': 'temperature', 'units': 'degrees_Celsius'}),
        'x': ('x', np.arange(10)),
        'y': ('y', np.arange(20)),
    },
    attrs={'description': 'example dataset'}
)
ds

Screen Shot 2020-06-16 at 4 45 48 AM

# DataArray repr
ds.temp

Screen Shot 2020-06-16 at 4 55 56 AM

Note that, by contrast, the text repr is dark theme friendly:

# Text repr
xr.set_options(display_style='text')
ds

Screen Shot 2020-06-16 at 5 01 40 AM

Versions

Jupyter versions jupyter core : 4.6.3

jupyter-notebook : 6.0.3

qtconsole : 4.7.4

ipython : 7.15.0

ipykernel : 5.3.0

jupyter client : 6.1.3

jupyter lab : not installed

nbconvert : 5.6.1

ipywidgets : 7.5.1

nbformat : 5.0.6

traitlets : 4.3.3

Output of xr.show_versions()

INSTALLED VERSIONS

commit: None
python: 3.8.3 | packaged by conda-forge | (default, Jun 1 2020, 17:43:00)
[GCC 7.5.0]
python-bits: 64
OS: Linux
OS-release: 3.10.0-957.27.2.el7.x86_64
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
libhdf5: None
libnetcdf: None

xarray: 0.15.1
pandas: 1.0.4
numpy: 1.18.4
scipy: 1.4.1
netCDF4: None
pydap: None
h5netcdf: None
h5py: None
Nio: None
zarr: None
cftime: None
nc_time_axis: None
PseudoNetCDF: None
rasterio: None
cfgrib: None
iris: None
bottleneck: None
dask: 2.17.2
distributed: 2.18.0
matplotlib: 3.2.1
cartopy: 0.18.0
seaborn: None
numbagg: None
setuptools: 47.1.1.post20200529
pip: 20.1.1
conda: 4.8.3
pytest: None
IPython: 7.15.0
sphinx: None

@dcherian
Copy link
Contributor

Hi @lukelbd. We would gladly take a PR for this. See #4036 for an example

@lukelbd
Copy link
Author

lukelbd commented Jun 17, 2020

Welp this was actually the catalyst for me to completely switch to jupyter lab, which I've been meaning to do for a while anyway 😅.

I'll close this to keep from cluttering your issue tracker, not sure it would be worth the development time to address this given that jupyter notebook is on its way out and jupyter-themes is a third-party extension which you aren't really obligated to support. I guess if anyone else chimes in with the same issue we can reopen

@lukelbd lukelbd closed this as completed Jun 17, 2020
@kmpaul kmpaul mentioned this issue Apr 14, 2022
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants