Skip to content

Commit ce834f1

Browse files
Variable explorer supports high contrast color themes (microsoft#13009)
1 parent 09c8d69 commit ce834f1

File tree

4 files changed

+67
-2
lines changed

4 files changed

+67
-2
lines changed

news/2 Fixes/12766.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Make the data science variable explorer support high contrast color theme.

src/datascience-ui/interactive-common/variableExplorer.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export class VariableExplorer extends React.Component<IVariableExplorerProps, IV
113113
key: 'buttons',
114114
name: '',
115115
type: 'boolean',
116-
width: 34,
116+
width: 36,
117117
sortable: false,
118118
resizable: false,
119119
formatter: (
@@ -275,7 +275,7 @@ export class VariableExplorer extends React.Component<IVariableExplorerProps, IV
275275
}
276276

277277
private getRowHeight() {
278-
return this.props.fontSize + 9;
278+
return this.props.fontSize + 11;
279279
}
280280

281281
private setInitialHeight() {

src/datascience-ui/interactive-common/variableExplorerCellFormatter.css

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,21 @@
1212

1313
.react-grid-variable-explorer-cell-numeric {
1414
color: var(--code-numeric-color, var(--vscode-editor-foreground));
15+
}
16+
17+
/* High contrast uses an inverse for selection highlights, so just use foreground when hovering */
18+
body.vscode-high-contrast .react-grid-Row:hover .react-grid-variable-explorer-cell-variable {
19+
color: var(--override-selection-foreground, var(--vscode-editor-selectionForeground));
20+
}
21+
22+
body.vscode-high-contrast .react-grid-Row:hover .react-grid-variable-explorer-cell-type {
23+
color: var(--override-selection-foreground, var(--vscode-editor-selectionForeground));
24+
}
25+
26+
body.vscode-high-contrast .react-grid-Row:hover .react-grid-variable-explorer-cell-string {
27+
color: var(--override-selection-foreground, var(--vscode-editor-selectionForeground));
28+
}
29+
30+
body.vscode-high-contrast .react-grid-Row:hover .react-grid-variable-explorer-cell-numeric {
31+
color: var(--override-selection-foreground, var(--vscode-editor-selectionForeground));
1532
}

src/datascience-ui/interactive-common/variableExplorerGrid.less

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,50 @@
7878
#variable-explorer-data-grid .rdg-selected {
7979
visibility: hidden;
8080
}
81+
82+
// High contrast theme changes
83+
84+
// Notifications-background and line-highlight-border don't work in high contrast mode, so skip the header color in high contrast themes
85+
body.vscode-high-contrast #variable-explorer-data-grid .react-grid-Header {
86+
background-color: var(--override-background, var(--vscode-editor-background));
87+
border-color: var(--override-foreground, var(--vscode-editor-foreground));
88+
}
89+
90+
body.vscode-high-contrast #variable-explorer-data-grid .react-grid-HeaderCell {
91+
background-color: var(--override-background, var(--vscode-editor-background));
92+
border-color: var(--override-foreground, var(--vscode-editor-foreground));
93+
}
94+
95+
body.vscode-high-contrast #variable-explorer-data-grid .react-grid-Row--odd {
96+
background-color: var(--override-background, var(--vscode-editor-background));
97+
border-color: var(--override-foreground, var(--vscode-editor-foreground));
98+
}
99+
100+
// Since we have removed zebra striping in HC mode, add back in grid lines
101+
body.vscode-high-contrast #variable-explorer-data-grid .react-grid-Cell {
102+
border-style: solid;
103+
border-width: 1px;
104+
border-color: var(--override-foreground, var(--vscode-editor-foreground));
105+
}
106+
107+
108+
// HC inverts selection colors, so use the selection foreground color on hover
109+
body.vscode-high-contrast #variable-explorer-data-grid .react-grid-Cell:hover {
110+
color: var(--override-selection-foreground, var(--vscode-editor-selectionForeground));
111+
}
112+
113+
body.vscode-high-contrast #variable-explorer-data-grid .react-grid-Row:hover {
114+
color: var(--override-selection-foreground, var(--vscode-editor-selectionForeground));
115+
}
116+
117+
body.vscode-high-contrast #variable-explorer-data-grid .react-grid-Row:hover .react-grid-Cell {
118+
color: var(--override-selection-foreground, var(--vscode-editor-selectionForeground));
119+
}
120+
121+
// HC inverts selection, which messes up our icons, just keep them with the same foreground / background combo
122+
body.vscode-high-contrast #variable-explorer-data-grid .react-grid-Row:hover .react-grid-Cell .variable-explorer-button-cell {
123+
color: var(--override-foreground, var(--vscode-editor-foreground));
124+
background-color: var(--override-background, var(--vscode-editor-background));
125+
}
126+
127+

0 commit comments

Comments
 (0)