Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ Deprecations
Bug Fixes
~~~~~~~~~

- Fix dark mode detection in VS Code by adding VS Code CSS variable support to the HTML representation CSS. (:pull:`11284`).
By `Maksymilian Wasilewski <https://github.com/maksmondeo>`_.
Comment on lines +110 to +111
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(:pull:XXXX) looks like a placeholder; the whats-new entries in this file use real PR numbers. Please replace XXXX with the actual pull request number before merging so the changelog renders correctly and cross-links properly.

Copilot uses AI. Check for mistakes.
- Allow writing ``StringDType`` variables to netCDF files (:issue:`11199`).
By `Kristian Kollsgård <https://github.com/kkollsga>`_.
- Fix ``Source`` link in api docs (:pull:`11187`)
Expand Down
53 changes: 37 additions & 16 deletions xarray/static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -40,36 +40,57 @@ html[data-theme="dark"],
body[data-theme="dark"],
body.vscode-dark {
--xr-font-color0: var(
--jp-content-font-color0,
var(--pst-color-text-base, rgba(255, 255, 255, 1))
--vscode-editor-foreground,
var(
--jp-content-font-color0,
Comment on lines -56 to +63
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new --vscode-* fallbacks are only applied inside the dark-theme selector block (html[...="dark"] / body[data-theme="dark"] / body.vscode-dark). If VS Code no longer sets body.vscode-dark (and also doesn’t set those data-theme/theme attributes), this rule won’t match and the HTML repr will still use the light :root defaults. To make VS Code theming work regardless of which theme markers are present, consider moving the --vscode-* fallbacks into the base :root variable definitions (so they apply whenever VS Code injects the CSS variables), and keep the dark selector only for environments that explicitly mark dark mode.

Copilot uses AI. Check for mistakes.
var(--pst-color-text-base, rgba(255, 255, 255, 1))
)
);
--xr-font-color2: var(
--jp-content-font-color2,
var(--pst-color-text-base, rgba(255, 255, 255, 0.54))
--vscode-descriptionForeground,
var(
--jp-content-font-color2,
var(--pst-color-text-base, rgba(255, 255, 255, 0.54))
)
);
--xr-font-color3: var(
--jp-content-font-color3,
var(--pst-color-text-base, rgba(255, 255, 255, 0.38))
--vscode-disabledForeground,
var(
--jp-content-font-color3,
var(--pst-color-text-base, rgba(255, 255, 255, 0.38))
)
);
--xr-border-color: var(
--jp-border-color2,
hsl(from var(--pst-color-on-background, #111111) h s calc(l + 10))
--vscode-panel-border,
var(
--jp-border-color2,
hsl(from var(--pst-color-on-background, #111111) h s calc(l + 10))
)
);
--xr-disabled-color: var(
--jp-layout-color3,
hsl(from var(--pst-color-on-background, #111111) h s calc(l + 40))
--vscode-disabledForeground,
var(
--jp-layout-color3,
hsl(from var(--pst-color-on-background, #111111) h s calc(l + 40))
)
);
--xr-background-color: var(
--jp-layout-color0,
var(--pst-color-on-background, #111111)
--vscode-editor-background,
var(--jp-layout-color0, var(--pst-color-on-background, #111111))
);
--xr-background-color-row-even: var(
--jp-layout-color1,
hsl(from var(--pst-color-on-background, #111111) h s calc(l + 5))
--vscode-list-hoverBackground,
var(
--jp-layout-color1,
hsl(from var(--pst-color-on-background, #111111) h s calc(l + 5))
)
);
--xr-background-color-row-odd: var(
--jp-layout-color2,
hsl(from var(--pst-color-on-background, #111111) h s calc(l + 15))
--vscode-list-inactiveSelectionBackground,
var(
--jp-layout-color2,
hsl(from var(--pst-color-on-background, #111111) h s calc(l + 15))
)
);
}

Expand Down
Loading