Skip to content

Commit 1e631a4

Browse files
authored
fix: apply theme accent color scale and other small tweaks (#1768)
- accent-100-1400 wasn't actually applied to spectrum, only actually matters in a few components (like checkboxes in lists), as most used other derived variables - enable stylelint on css files - change item list selected border color to match iris-grid selected border color (e2e item-list-selected-border change) - manually override spectrum selected border color in lists and tables to not be hardcoded as blue, instead use accent - adjusted inactive bg color in light theme - fix mitre gaps in file list and command history list now that border is more visible fixes small mitre gaps: ![image_360](https://github.com/deephaven/web-client-ui/assets/1576283/ba823c32-9c83-4c83-adf8-7402edf66ec0)
1 parent e6dd3e1 commit 1e631a4

13 files changed

Lines changed: 93 additions & 27 deletions

jest.config.lint.cjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@ module.exports = {
1212
displayName: 'stylelint',
1313
runner: 'jest-runner-stylelint',
1414
testMatch: [
15+
'<rootDir>/packages/*/src/**/*.css',
1516
'<rootDir>/packages/*/src/**/*.scss',
1617
'<rootDir>/packages/*/scss/**/*.scss',
1718
],
1819
testPathIgnorePatterns: ['<rootDir>/packages/golden-layout/*'],
19-
moduleFileExtensions: ['scss'],
20+
moduleFileExtensions: ['css', 'scss'],
2021
testEnvironment: 'node',
2122
},
2223
],

packages/components/src/theme/theme-dark/theme-dark-components.css

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,7 @@
115115
--dh-color-highlight-selected-hover
116116
);
117117
--dh-color-item-list-selected-inactive-bg: var(--dh-color-gray-200);
118-
--dh-color-item-list-selected-border: color-mix(
119-
in srgb,
120-
var(--dh-color-accent) 60%,
121-
transparent
122-
);
118+
--dh-color-item-list-selected-border: var(--dh-color-accent-900);
123119
--dh-color-item-list-drop-target-fg: var(--dh-color-white);
124120

125121
--dh-color-item-list-keyboard-selected-bg: color-mix(

packages/components/src/theme/theme-dark/theme-dark-palette.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* stylelint-disable custom-property-empty-line-before */
1+
/* stylelint-disable custom-property-empty-line-before, color-hex-length */
22
:root {
33
/* Gray */
44
--dh-color-gray-50: #1a171a;

packages/components/src/theme/theme-light/theme-light-components.css

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,8 @@
114114
--dh-color-item-list-selected-hover-bg: var(
115115
--dh-color-highlight-selected-hover
116116
);
117-
--dh-color-item-list-selected-inactive-bg: var(--dh-color-gray-200);
118-
--dh-color-item-list-selected-border: color-mix(
119-
in srgb,
120-
var(--dh-color-accent) 60%,
121-
transparent
122-
);
117+
--dh-color-item-list-selected-inactive-bg: var(--dh-color-gray-300);
118+
--dh-color-item-list-selected-border: var(--dh-color-accent-900);
123119
--dh-color-item-list-drop-target-fg: var(--dh-color-white);
124120

125121
--dh-color-item-list-keyboard-selected-bg: color-mix(

packages/components/src/theme/theme-light/theme-light-palette.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* stylelint-disable custom-property-empty-line-before */
1+
/* stylelint-disable custom-property-empty-line-before, color-hex-length */
22
:root {
33
--dh-color-gray-50: #ffffff;
44
--dh-color-gray-75: #fafafa;

packages/components/src/theme/theme-spectrum/theme-spectrum-alias.module.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,21 @@
147147
--dh-color-accent-key-focus-bg
148148
);
149149

150+
--spectrum-accent-color-100: var(--dh-color-accent-100);
151+
--spectrum-accent-color-200: var(--dh-color-accent-200);
152+
--spectrum-accent-color-300: var(--dh-color-accent-300);
153+
--spectrum-accent-color-400: var(--dh-color-accent-400);
154+
--spectrum-accent-color-500: var(--dh-color-accent-500);
155+
--spectrum-accent-color-600: var(--dh-color-accent-600);
156+
--spectrum-accent-color-700: var(--dh-color-accent-700);
157+
--spectrum-accent-color-800: var(--dh-color-accent-800);
158+
--spectrum-accent-color-900: var(--dh-color-accent-900);
159+
--spectrum-accent-color-1000: var(--dh-color-accent-1000);
160+
--spectrum-accent-color-1100: var(--dh-color-accent-1100);
161+
--spectrum-accent-color-1200: var(--dh-color-accent-1200);
162+
--spectrum-accent-color-1300: var(--dh-color-accent-1300);
163+
--spectrum-accent-color-1400: var(--dh-color-accent-1400);
164+
150165
/* Neutral */
151166
--spectrum-neutral-background-color-default: var(--dh-color-neutral-bg);
152167
--spectrum-neutral-background-color-hover: var(--dh-color-neutral-hover-bg);

packages/components/src/theme/theme-spectrum/theme-spectrum-overrides.css

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,37 @@ label[class^='spectrum-'] {
2929
);
3030
}
3131

32+
/* Table */
3233
[class^='spectrum-Table-headCell'] {
3334
/*
3435
Tables are styled with the assumption that the header is the same color as the bg
3536
which means they look bad against any other background color, instead just inherit the bg.
3637
There is also no variable exposed for this, so we have to target the class directly.
3738
*/
3839
--dh-table-header-cell-background-color: transparent;
40+
3941
background: var(--dh-table-header-cell-background-color);
4042
}
4143

42-
/* Table */
44+
[class^='spectrum-Table-row'] {
45+
/* border of selected color is hard-coded as blue rather than accent color */
46+
--spectrum-table-row-border-color-selected: var(
47+
--dh-color-item-list-selected-border
48+
);
49+
}
50+
4351
[class*='spectrum-Table--quiet'] {
4452
/* Quiet shouldn't assume a bg color */
4553
--spectrum-alias-background-color-default: transparent;
4654
}
4755

56+
[class*='spectrum-ListView'] {
57+
/* border of selected color is hard-coded as blue rather than accent color */
58+
--spectrum-listview-item-border-color-selected: var(
59+
--dh-color-item-list-selected-border
60+
);
61+
}
62+
4863
button[class^='spectrum-Button'] {
4964
/* make the icon closer to the text */
5065
--spectrum-button-primary-text-gap: var(--spectrum-global-dimension-size-75);

packages/console/src/command-history/CommandHistory.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ $command-history-search-toolbar-bg: $content-bg;
2121
padding: 0;
2222
.item-list-scroll-pane {
2323
border: none;
24+
border-radius: 0;
2425
}
2526
}
2627
}

packages/console/src/command-history/CommandHistoryItem.scss

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ $item-list-selection-border-color: var(--dh-color-item-list-selected-border);
88
$item-list-focused-bg: var(--dh-color-item-list-selected-bg);
99
$item-list-hover-bg: var(--dh-color-item-list-hover-bg);
1010
$item-list-selected-color: var(--dh-color-item-list-selected-fg);
11+
$item-list-border-width: 1px;
1112

1213
.command-history {
1314
.command-history-item {
@@ -27,7 +28,7 @@ $item-list-selected-color: var(--dh-color-item-list-selected-fg);
2728
cursor: pointer;
2829
user-select: none;
2930
line-height: 27px; // CommandHistory.ITEM_HEIGHT - borders
30-
border: 1px solid transparent; //we need a spacer border so stuff doesn't move on us when we apply a border-color
31+
border: $item-list-border-width solid transparent; //we need a spacer border so stuff doesn't move on us when we apply a border-color
3132
}
3233

3334
.item-list-item.is-focused {
@@ -51,8 +52,23 @@ $item-list-selected-color: var(--dh-color-item-list-selected-fg);
5152
.command-history:focus-within .item-list-item.active {
5253
background-color: $item-list-selected-bg;
5354
color: $item-list-selected-color;
54-
border-left-color: $item-list-selection-border-color;
55-
border-right-color: $item-list-selection-border-color;
55+
// because of border mitre, we use pseudo elements to act as borders
56+
// otherwise we get mitre gap beteween the borders
57+
::before,
58+
::after {
59+
content: '';
60+
position: absolute;
61+
top: -$item-list-border-width;
62+
bottom: -$item-list-border-width * 2; // times 2 the bottom border is actually the top of next item
63+
width: $item-list-border-width;
64+
background-color: $item-list-selection-border-color;
65+
}
66+
::before {
67+
left: -$item-list-border-width;
68+
}
69+
::after {
70+
right: -$item-list-border-width;
71+
}
5672
}
5773

5874
.command-history .item-list-item:hover {
@@ -68,16 +84,20 @@ $item-list-selected-color: var(--dh-color-item-list-selected-fg);
6884
//apply border to top of the first item in the list if its selected, and the first selected after a non-selected item
6985
.command-history:focus-within .item-list-item:not(.active) + .active,
7086
.command-history:focus-within .item-list-item.active:first-of-type {
71-
border-top: 1px solid $item-list-selection-border-color;
87+
border-top: $item-list-border-width solid $item-list-selection-border-color;
7288
}
7389

7490
//there's no easy way to get the last select item in a grouping, so we apply the end border
7591
//to the TOP of the first non-selected item, ie. the previous selection group
7692
.command-history:focus-within .active + .item-list-item:not(.active) {
77-
border-top: 1px solid $item-list-selection-border-color;
93+
border-top: $item-list-border-width solid $item-list-selection-border-color;
7894
}
7995

8096
//since there is no item after the last item in teh selection, we apply the border to the bottom of the last selected element
8197
.command-history:focus-within .item-list-item.active:last-of-type {
82-
border-bottom: 1px solid $item-list-selection-border-color;
98+
border-bottom: $item-list-border-width solid $item-list-selection-border-color;
99+
::before,
100+
::after {
101+
bottom: -$item-list-border-width; // not times 2, because there is no next item
102+
}
83103
}

packages/file-explorer/src/FileList.scss

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
$depth-line-color: $gray-600;
44
$depth-margin: 5px;
55
$depth-indentation: 8px;
6+
$item-list-border-width: 1px;
67
$item-list-color: $text-muted;
78
$item-list-selected-nofocus-bg: var(--dh-color-item-list-selected-inactive-bg);
89
$item-list-selected-bg: var(--dh-color-item-list-selected-bg);
@@ -31,12 +32,13 @@ $item-list-drop-target-color: var(--dh-color-item-list-drop-target-fg);
3132

3233
.item-list-scroll-pane {
3334
border: none;
35+
border-radius: 0;
3436
}
3537

3638
.item-list-item {
3739
padding: 0 $input-btn-padding-x;
3840
color: $item-list-color;
39-
border: 1px solid transparent; // we need a spacer border so stuff doesn't move on us when we apply a border-color
41+
border: $item-list-border-width solid transparent; // we need a spacer border so stuff doesn't move on us when we apply a border-color
4042
-webkit-user-drag: none; // we need to disable webkit-user-drag or else Chrome switches to a Copy icon when dragging on Mac
4143
cursor: pointer;
4244

@@ -75,8 +77,23 @@ $item-list-drop-target-color: var(--dh-color-item-list-drop-target-fg);
7577
.item-list-item.active {
7678
background-color: $item-list-selected-bg;
7779
color: $item-list-selected-color;
78-
border-left-color: $item-list-selection-border-color;
79-
border-right-color: $item-list-selection-border-color;
80+
// because of border mitre, we use pseudo elements to act as borders
81+
// otherwise we get mitre gap beteween the borders
82+
::before,
83+
::after {
84+
content: '';
85+
position: absolute;
86+
top: -$item-list-border-width;
87+
bottom: -$item-list-border-width * 2; // times 2 the bottom border is actually the top of next item
88+
width: $item-list-border-width;
89+
background-color: $item-list-selection-border-color;
90+
}
91+
::before {
92+
left: -$item-list-border-width;
93+
}
94+
::after {
95+
right: -$item-list-border-width;
96+
}
8097
}
8198
}
8299

@@ -110,18 +127,23 @@ $item-list-drop-target-color: var(--dh-color-item-list-drop-target-fg);
110127
//apply border to top of the first item in the list if its selected, and the first selected after a non-selected item
111128
&:focus-within .item-list-item:not(.active) + .active,
112129
&:focus-within .item-list-item.active:first-of-type {
113-
border-top: 1px solid $item-list-selection-border-color;
130+
border-top: $item-list-border-width solid $item-list-selection-border-color;
114131
}
115132

116133
//there's no easy way to get the last select item in a grouping, so we apply the end border
117134
//to the TOP of the first non-selected item, ie. the previous selection group
118135
&:focus-within .item-list-item.active + .item-list-item:not(.active) {
119-
border-top: 1px solid $item-list-selection-border-color;
136+
border-top: $item-list-border-width solid $item-list-selection-border-color;
120137
}
121138

122139
//since there is no item after the last item in teh selection, we apply the border to the bottom of the last selected element
123140
&:focus-within .item-list-item.active:last-of-type {
124-
border-bottom: 1px solid $item-list-selection-border-color;
141+
border-bottom: $item-list-border-width solid
142+
$item-list-selection-border-color;
143+
::before,
144+
::after {
145+
bottom: 0; // not times 2 because there is no next item
146+
}
125147
}
126148
/* stylelint-enable no-descending-specificity */
127149
}

0 commit comments

Comments
 (0)