Skip to content

Commit ce26749

Browse files
committed
Update theme files and provide updated variable names for Material theme
1 parent d64ac26 commit ce26749

File tree

5 files changed

+80
-11
lines changed

5 files changed

+80
-11
lines changed

modules/web/src/app/core/components/notification-panel/theme.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
}
2727

2828
.notification-badge {
29-
border: 1px solid map.get($colors, background-app-bar);
29+
border: 1px solid map.get($colors, background-card);
3030
color: #fff;
3131
}
3232
}

modules/web/src/app/core/components/notification/theme.scss

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,37 @@
1515
@use 'sass:map';
1616

1717
@mixin theme-notification-component($colors) {
18-
km-notification {
19-
background: map.get($colors, background-app-bar);
20-
color: map.get($colors, text);
18+
.mat-mdc-snack-bar-container km-notification,
19+
.cdk-overlay-pane:has(km-notification) .mat-mdc-snack-bar-container {
20+
// Override Material Design CSS custom properties with theme colors
21+
--mdc-snackbar-container-color: #{map.get($colors, background-card)};
22+
--mdc-snackbar-supporting-text-color: #{map.get($colors, text)};
23+
--mat-snack-bar-button-color: #{map.get($colors, primary)};
2124

22-
.notification-container {
23-
&.show-message-section > :nth-child(-n + 3) {
24-
border-bottom: 1px solid map.get($colors, divider);
25+
// Dialog component CSS custom properties for dialogs containing notifications
26+
--mdc-dialog-container-color: #{map.get($colors, background-dialog)};
27+
--mdc-dialog-supporting-text-color: #{map.get($colors, text)};
28+
29+
.mat-mdc-snackbar-surface,
30+
.mdc-snackbar__surface {
31+
background-color: var(--mdc-snackbar-container-color) !important;
32+
color: var(--mdc-snackbar-supporting-text-color) !important;
33+
}
34+
35+
.mat-mdc-snack-bar-label {
36+
color: var(--mdc-snackbar-supporting-text-color) !important;
37+
}
38+
39+
// Ensure our km-notification component also gets the colors
40+
km-notification {
41+
background-color: var(--mdc-snackbar-container-color) !important;
42+
color: var(--mdc-snackbar-supporting-text-color) !important;
43+
44+
45+
.notification-container {
46+
&.show-message-section > :nth-child(-n + 3) {
47+
border-bottom: 1px solid map.get($colors, divider);
48+
}
2549
}
2650
}
2751
}

modules/web/src/assets/css/theme/_main.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ $my-typography: mat.m2-define-typography-config(
3131
$palette-background: map.get($theme, background);
3232
$palette-foreground: map.get($theme, foreground);
3333
$theme-colors: (
34-
background-app-bar: mat.m2-get-color-from-palette($palette-background, app-bar),
35-
background-card: mat.m2-get-color-from-palette($palette-background, card),
36-
background-dialog: mat.m2-get-color-from-palette($palette-background, dialog),
34+
background-app-bar: map.get($palette-background, app-bar),
35+
background-card: map.get($palette-background, card),
36+
background-dialog: map.get($palette-background, dialog),
3737
background-disabled-button: mat.m2-get-color-from-palette($palette-background, disabled-button),
38-
background-hover: mat.m2-get-color-from-palette($palette-background, hover),
38+
background-hover: map.get($palette-background, hover),
3939
background: mat.m2-get-color-from-palette($palette-background, background),
4040
checkbox-disabled: mat.m2-get-color-from-palette($palette-foreground, disabled-checkbox),
4141
checkbox-disabled-checked: mat.m2-get-color-from-palette($palette-foreground, disabled-checkbox-checked),

modules/web/src/assets/themes/dark.scss

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,19 @@ $theme-dark: map.merge(
187187
@include mat.all-component-themes($theme-dark);
188188
@include main.theme($theme-dark, $colors-dark);
189189

190+
// Override Angular Material v20 CSS custom properties for components
191+
:root {
192+
--mat-card-outlined-container-color: #{map.get($background, card)};
193+
--mat-card-elevated-container-color: #{map.get($background, card)};
194+
--mat-card-filled-container-color: #{map.get($background, card)};
195+
196+
--mat-table-background-color: #{map.get($background, card)};
197+
--mat-stepper-container-color: #{map.get($background, card)};
198+
--mat-button-toggle-background-color: #{map.get($background, card)};
199+
200+
--mdc-dialog-container-color: #{map.get($background, dialog)};
201+
}
202+
190203
// Make icons and logos white with 85% opacity.
191204
.km-header-logo,
192205
.km-provider-logo,

modules/web/src/assets/themes/light.scss

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,30 @@ $background: map.merge(
8888
background: #edeff0,
8989
)
9090
);
91+
$background: map.merge(
92+
$background,
93+
(
94+
hover: #f5f5f5,
95+
)
96+
);
9197
$background: map.merge(
9298
$background,
9399
(
94100
app-bar: #fff,
95101
)
96102
);
103+
$background: map.merge(
104+
$background,
105+
(
106+
card: #fff,
107+
)
108+
);
109+
$background: map.merge(
110+
$background,
111+
(
112+
dialog: #fff,
113+
)
114+
);
97115
$theme-light: map.merge(
98116
$theme-light,
99117
(
@@ -164,3 +182,17 @@ $theme-light: map.merge(
164182

165183
@include mat.all-component-themes($theme-light);
166184
@include main.theme($theme-light, $colors-light);
185+
186+
187+
// Override Angular Material v20 CSS custom properties for components
188+
:root {
189+
--mat-card-outlined-container-color: #{map.get($background, card)};
190+
--mat-card-elevated-container-color: #{map.get($background, card)};
191+
--mat-card-filled-container-color: #{map.get($background, card)};
192+
193+
--mat-table-background-color: #{map.get($background, card)};
194+
--mat-stepper-container-color: #{map.get($background, card)};
195+
--mat-button-toggle-background-color: #{map.get($background, card)};
196+
197+
--mdc-dialog-container-color: #{map.get($background, dialog)};
198+
}

0 commit comments

Comments
 (0)