Skip to content

Commit 7f6add6

Browse files
authored
html repr: improve style for dropdown sections (#10354)
1 parent 42836f3 commit 7f6add6

File tree

2 files changed

+32
-3
lines changed

2 files changed

+32
-3
lines changed

doc/whats-new.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ Bug fixes
5050
calculating mean in rolling for correct operations (preserve float dtypes,
5151
correct mean of bool arrays) (:issue:`10340`, :pull:`10341`).
5252
By `Kai Mühlbauer <https://github.com/kmuehlbauer>`_.
53+
- Improve the html ``repr`` of Xarray objects (dark mode, icons and variable attribute / data
54+
dropdown sections).
55+
(:pull:`10353`, :pull:`10354`)
56+
By `Benoit Bovy <https://github.com/benbovy>`_.
5357
- Raise an error when attempting to encode :py:class:`numpy.datetime64` values
5458
prior to the Gregorian calendar reform date of 1582-10-15 with a
5559
``"standard"`` or ``"gregorian"`` calendar. Previously we would warn and

xarray/static/css/style.css

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ body.vscode-dark {
128128

129129
.xr-section-item input + label {
130130
color: var(--xr-disabled-color);
131+
border: 2px solid transparent !important;
131132
}
132133

133134
.xr-section-item input:enabled + label {
@@ -136,7 +137,7 @@ body.vscode-dark {
136137
}
137138

138139
.xr-section-item input:focus + label {
139-
border: 2px solid var(--xr-font-color0);
140+
border: 2px solid var(--xr-font-color0) !important;
140141
}
141142

142143
.xr-section-item input:enabled + label:hover {
@@ -268,7 +269,9 @@ body.vscode-dark {
268269
.xr-var-item label,
269270
.xr-var-item > .xr-var-name span {
270271
background-color: var(--xr-background-color-row-even);
272+
border-color: var(--xr-background-color-row-odd);
271273
margin-bottom: 0;
274+
padding-top: 2px;
272275
}
273276

274277
.xr-var-item > .xr-var-name:hover span {
@@ -279,6 +282,7 @@ body.vscode-dark {
279282
.xr-var-list > li:nth-child(odd) > label,
280283
.xr-var-list > li:nth-child(odd) > .xr-var-name span {
281284
background-color: var(--xr-background-color-row-odd);
285+
border-color: var(--xr-background-color-row-even);
282286
}
283287

284288
.xr-var-name {
@@ -328,8 +332,15 @@ body.vscode-dark {
328332
.xr-var-data,
329333
.xr-index-data {
330334
display: none;
331-
background-color: var(--xr-background-color) !important;
332-
padding-bottom: 5px !important;
335+
border-top: 2px dotted var(--xr-background-color);
336+
padding-bottom: 20px !important;
337+
padding-top: 10px !important;
338+
}
339+
340+
.xr-var-attrs-in + label,
341+
.xr-var-data-in + label,
342+
.xr-index-data-in + label {
343+
padding: 0 1px;
333344
}
334345

335346
.xr-var-attrs-in:checked ~ .xr-var-attrs,
@@ -342,6 +353,12 @@ body.vscode-dark {
342353
float: right;
343354
}
344355

356+
.xr-var-data > pre,
357+
.xr-index-data > pre,
358+
.xr-var-data > table > tbody > tr {
359+
background-color: transparent !important;
360+
}
361+
345362
.xr-var-name span,
346363
.xr-var-data,
347364
.xr-index-name div,
@@ -401,3 +418,11 @@ dl.xr-attrs {
401418
stroke: currentColor;
402419
fill: currentColor;
403420
}
421+
422+
.xr-var-attrs-in:checked + label > .xr-icon-file-text2,
423+
.xr-var-data-in:checked + label > .xr-icon-database,
424+
.xr-index-data-in:checked + label > .xr-icon-database {
425+
color: var(--xr-font-color0);
426+
filter: drop-shadow(1px 1px 5px var(--xr-font-color2));
427+
stroke-width: 0.8px;
428+
}

0 commit comments

Comments
 (0)