Skip to content

Commit 79bec59

Browse files
authored
Change to facilitate Angular Material theming API update (#6507)
We're in the process of changing the Angular Material components to use CSS variables for theming. This involves moving some declarations from the theme to the component base styles which changes its specificity. One such change that breaks the Tensorboard screenshot tests is angular/components#27479. The problem boils down to the fact that because the styles that override the form field color are in the base styles now _and_ the Tensorboard dark theme targets `body.dark-mode`, only in dark mode some of the select declarations aren't being overwritten anymore. This won't be a problem once Tensorboard moves away from the legacy Angular Material components, but for now this patch is necessary to ensure that it doesn't blend into the toolbar. **Note:** these changes will require some minor updates to the existing internal screenshots. See cl/549228851 for more info.
1 parent 6169001 commit 79bec59

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tensorboard/webapp/header/plugin_selector_component.scss

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,25 @@ mat-option {
5353
width: 100%;
5454
}
5555

56+
// TODO(tensorboard-team): Can probably remove after migrating away from Legacy Material components.
57+
// These styles exist in `mat-toolbar` already, but the combination of the
58+
// dark theme selector being `body.dark-theme` and the legacy select component
59+
// being used causes the styles to be overwritten in a dark theme.
60+
:host ::ng-deep .mat-form-field.mat-form-field.mat-form-field {
61+
.mat-form-field-underline,
62+
.mat-form-field-ripple,
63+
&.mat-focused .mat-form-field-ripple {
64+
background-color: currentColor;
65+
}
66+
67+
.mat-select-value,
68+
.mat-select-arrow,
69+
&.mat-focused .mat-form-field-label,
70+
&.mat-focused .mat-select-arrow {
71+
color: inherit;
72+
}
73+
}
74+
5675
:host ::ng-deep .active-plugin-list {
5776
// Override mat-tab styling. By default, mat-tab has the right styling but,
5877
// here, we are using it under dark header background. Must invert the color.

0 commit comments

Comments
 (0)