UNPKG

17.8 kBSCSSView Raw
1@use '@angular/material' as mat;
2@import '@covalent/tokens';
3
4// Customer Teradata brand palette
5// Define the palettes for your theme using the Material Design palettes available in palette.scss
6// (imported above). For each palette, you can optionally specify a default, lighter, and darker
7// hue.
8$td-theme: map-get($tokens, 'theme');
9$td-theme-dark: map-get($td-theme, 'dark');
10$td-dark-palettes: map-get($td-theme-dark, 'palettes');
11$td-dark-colors: map-get($td-theme-dark, 'colors');
12
13$td-theme-light: map-get($td-theme, 'light');
14$td-light-palettes: map-get($td-theme-light, 'palettes');
15$td-light-colors: map-get($td-theme-light, 'colors');
16
17// Digital blue
18// Add contrast for angular palette
19$td-digital-blue-light: map-merge(
20 (
21 '200': map-get($td-light-palettes, 'digital blue 20'),
22 '30': map-get($td-light-palettes, 'digital blue 30'),
23 '300': map-get($td-light-palettes, 'digital blue 30'),
24 '40': map-get($td-light-palettes, 'digital blue 40'),
25 '50': map-get($td-light-palettes, 'digital blue 50'),
26 '500': map-get($td-light-palettes, 'digital blue 50'),
27 '60': map-get($td-light-palettes, 'digital blue 60'),
28 '600': map-get($td-light-palettes, 'digital blue 60'),
29 '70': map-get($td-light-palettes, 'digital blue 70'),
30 '80': map-get($td-light-palettes, 'digital blue 80'),
31 '90': map-get($td-light-palettes, 'digital blue 90'),
32 '900': map-get($td-light-palettes, 'digital blue 90'),
33 ),
34 (
35 contrast: (
36 '20': $light-on-primary,
37 '30': $light-on-primary,
38 '300': $light-on-primary,
39 '40': $light-on-primary,
40 '50': $light-on-primary,
41 '500': $light-on-primary,
42 '60': $light-on-primary,
43 '600': $light-on-primary,
44 '70': $light-on-primary,
45 '80': $light-on-primary,
46 '90': $light-on-primary,
47 '900': $light-on-primary,
48 ),
49 )
50);
51$td-digital-blue-dark: map-merge(
52 (
53 '200': map-get($td-dark-palettes, 'digital blue 20'),
54 '30': map-get($td-dark-palettes, 'digital blue 30'),
55 '300': map-get($td-dark-palettes, 'digital blue 30'),
56 '40': map-get($td-dark-palettes, 'digital blue 40'),
57 '50': map-get($td-dark-palettes, 'digital blue 50'),
58 '500': map-get($td-dark-palettes, 'digital blue 50'),
59 '60': map-get($td-dark-palettes, 'digital blue 60'),
60 '600': map-get($td-dark-palettes, 'digital blue 60'),
61 '70': map-get($td-dark-palettes, 'digital blue 70'),
62 '80': map-get($td-dark-palettes, 'digital blue 80'),
63 '90': map-get($td-dark-palettes, 'digital blue 90'),
64 '900': map-get($td-dark-palettes, 'digital blue 90'),
65 ),
66 (
67 contrast: (
68 '200': $dark-on-primary,
69 '30': $dark-on-primary,
70 '300': $dark-on-primary,
71 '40': $dark-on-primary,
72 '50': $dark-on-primary,
73 '500': $dark-on-primary,
74 '60': $dark-on-primary,
75 '600': $dark-on-primary,
76 '70': $dark-on-primary,
77 '80': $dark-on-primary,
78 '90': $dark-on-primary,
79 '900': $dark-on-primary,
80 ),
81 )
82);
83
84// Secondary
85// Add contrast for angular palette
86$td-secondary-light: map-merge(
87 (
88 '30': map-get($td-light-palettes, 'secondary 30'),
89 '40': map-get($td-light-palettes, 'secondary 40'),
90 '50': map-get($td-light-palettes, 'secondary 50'),
91 '500': map-get($td-light-palettes, 'secondary 50'),
92 '60': map-get($td-light-palettes, 'secondary 60'),
93 '70': map-get($td-light-palettes, 'secondary 70'),
94 '80': map-get($td-light-palettes, 'secondary 80'),
95 '90': map-get($td-light-palettes, 'secondary 90'),
96 ),
97 (
98 contrast: (
99 '30': $light-on-secondary,
100 '40': $light-on-secondary,
101 '50': $light-on-secondary,
102 '500': $light-on-secondary,
103 '60': $light-on-secondary,
104 '70': $light-on-secondary,
105 '80': $light-on-secondary,
106 '90': $light-on-secondary,
107 ),
108 )
109);
110$td-secondary-dark: map-merge(
111 (
112 '30': map-get($td-dark-palettes, 'secondary 30'),
113 '40': map-get($td-dark-palettes, 'secondary 40'),
114 '50': map-get($td-dark-palettes, 'secondary 50'),
115 '500': map-get($td-dark-palettes, 'secondary 50'),
116 '60': map-get($td-dark-palettes, 'secondary 60'),
117 '70': map-get($td-dark-palettes, 'secondary 70'),
118 '80': map-get($td-dark-palettes, 'secondary 80'),
119 '90': map-get($td-dark-palettes, 'secondary 90'),
120 ),
121 (
122 contrast: (
123 '30': $dark-on-secondary,
124 '40': $dark-on-secondary,
125 '50': $dark-on-secondary,
126 '500': $dark-on-secondary,
127 '60': $dark-on-secondary,
128 '70': $dark-on-secondary,
129 '80': $dark-on-secondary,
130 '90': $dark-on-secondary,
131 ),
132 )
133);
134
135// Warn
136// Add contrast for angular palette
137$td-warn-light: map-merge(
138 (
139 '30': map-get($td-light-palettes, 'negative 30'),
140 '40': map-get($td-light-palettes, 'negative 40'),
141 '50': map-get($td-light-palettes, 'negative 50'),
142 '500': map-get($td-light-palettes, 'negative 50'),
143 '60': map-get($td-light-palettes, 'negative 60'),
144 '70': map-get($td-light-palettes, 'negative 70'),
145 '80': map-get($td-light-palettes, 'negative 80'),
146 '90': map-get($td-light-palettes, 'negative 90'),
147 ),
148 (
149 contrast: (
150 '30': $theme-light-colors-on-negative,
151 '40': $theme-light-colors-on-negative,
152 '50': $theme-light-colors-on-negative,
153 '500': $theme-light-colors-on-negative,
154 '60': $theme-light-colors-on-negative,
155 '70': $theme-light-colors-on-negative,
156 '80': $theme-light-colors-on-negative,
157 '90': $theme-light-colors-on-negative,
158 ),
159 )
160);
161$td-warn-dark: map-merge(
162 (
163 '30': map-get($td-dark-palettes, 'negative 30'),
164 '40': map-get($td-dark-palettes, 'negative 40'),
165 '50': map-get($td-dark-palettes, 'negative 50'),
166 '500': map-get($td-dark-palettes, 'negative 50'),
167 '60': map-get($td-dark-palettes, 'negative 60'),
168 '70': map-get($td-dark-palettes, 'negative 70'),
169 '80': map-get($td-dark-palettes, 'negative 80'),
170 '90': map-get($td-dark-palettes, 'negative 90'),
171 ),
172 (
173 contrast: (
174 '30': $theme-dark-colors-on-negative,
175 '40': $theme-dark-colors-on-negative,
176 '50': $theme-dark-colors-on-negative,
177 '500': $theme-dark-colors-on-negative,
178 '60': $theme-dark-colors-on-negative,
179 '70': $theme-dark-colors-on-negative,
180 '80': $theme-dark-colors-on-negative,
181 '90': $theme-dark-colors-on-negative,
182 ),
183 )
184);
185
186$td-primary: $td-digital-blue-light;
187$td-secondary: $td-secondary-light;
188$td-accent: $td-digital-blue-light;
189// The warn palette is optional (defaults to red).
190$td-warn: $td-warn-light;
191
192// Dark theme tokens
193$td-primary-dark: $td-digital-blue-dark;
194$td-secondary-dark: $td-secondary-dark;
195$td-accent-dark: $td-digital-blue-dark;
196// The warn palette is optional (defaults to red).
197$td-warn-dark: $td-warn-dark;
198
199// Background palette for light themes.
200// todo: need to re-catalog used variables
201$td-light-theme-background: (
202 status-bar: $theme-light-colors-surface-container-lowest,
203 app-bar: $theme-light-colors-surface-container-low,
204 background: $theme-light-colors-surface,
205 canvas: $light-surface-canvas,
206 card: $theme-light-colors-surface-container
207 /*** card color = surface color ***/,
208 dialog: $theme-light-colors-surface-container-high,
209 hover: $light-surface-primary-highlight-hover,
210 disabled-button: $theme-light-colors-surface-dim,
211 disabled-button-toggle: $theme-light-colors-surface-dim,
212 disabled-list-option: $theme-light-colors-surface-dim,
213 raised-button: $light-surface-primary,
214 focused-button: $light-surface-primary-highlight,
215 selected-button: $theme-light-colors-surface-dim,
216 selected-disabled-button: $theme-light-colors-surface-dim,
217 unselected-chip: $theme-light-colors-surface-variant,
218 tooltip: $theme-light-colors-inverse-surface,
219 overlay: $theme-light-colors-scrim,
220 accent: $light-accent,
221 accent-highlight: $light-surface-accent-highlight,
222 accent-highlight-hover: $light-surface-accent-highlight-hover,
223 emphasis: $light-emphasis,
224 emphasis-highlight: $light-surface-emphasis-highlight,
225 emphasis-highlight-hover: $light-surface-emphasis-highlight,
226 caution: $light-surface-caution,
227 caution-highlight: $light-surface-caution-highlight,
228 caution-highlight-hover: $light-surface-caution-highlight-hover,
229 negative: $light-surface-negative,
230 negative-highlight: $light-surface-negative-highlight,
231 negative-highlight-hover: $light-surface-negative-highlight-hover,
232 neutral: $light-surface-neutral,
233 neutral-highlight: $light-surface-neutral-highlight,
234 neutral-highlight-hover: $light-surface-neutral-highlight-hover,
235 positive: $light-surface-positive,
236 positive-highlight: $light-surface-positive-highlight,
237 positive-highlight-hover: $light-surface-positive-highlight-hover,
238 primary: $light-surface-primary,
239 primary-highlight: $light-surface-primary-highlight,
240 primary-highlight-hover: $light-surface-primary-highlight-hover,
241);
242
243// Foreground palette for light themes.
244// todo: need to re-catalog used variables
245$td-light-theme-foreground: (
246 base: $light-on-background,
247 divider: $light-divider,
248 dividers: $light-divider,
249 disabled: $theme-light-colors-on-surface-38,
250 disabled-button: $theme-light-colors-on-surface-38,
251 disabled-text: $theme-light-colors-on-surface-38,
252 elevation: black,
253 // todo: need to work out elevation
254 hint-text: $theme-light-colors-on-surface-variant,
255 secondary-text: $theme-light-colors-on-surface-variant,
256 icon: $light-text-icon-on-background,
257 icons: $light-text-icon-on-background,
258 inverse-on-surface: $theme-light-colors-inverse-on-surface,
259 text: $light-on-surface,
260 slider-min: $light-on-surface,
261 slider-off: $theme-light-colors-on-surface-8,
262 slider-off-active: $theme-light-colors-on-surface-16,
263 accent: $theme-light-colors-on-primary,
264 emphasis: $theme-light-colors-on-emphasis,
265 caution: $theme-light-colors-on-caution,
266 negative: $theme-light-colors-on-negative,
267 neutral: $light-on-surface,
268 // todo: need to work out on-neutral tokens
269 positive: $theme-light-colors-on-positive,
270 primary: $theme-light-colors-on-primary,
271);
272
273// Background palette for dark themes.
274// todo: need to re-catalog used variables
275$td-dark-theme-background: (
276 status-bar: $theme-dark-colors-surface-container-lowest,
277 app-bar: $theme-dark-colors-surface-container-low,
278 background: $theme-dark-colors-surface,
279 canvas: $dark-surface-canvas,
280 card: $theme-dark-colors-surface-container
281 /*** card color = surface color ***/,
282 dialog: $theme-dark-colors-surface-container-high,
283 hover: $dark-surface-primary-highlight-hover,
284 disabled-button: $theme-dark-colors-surface-dim,
285 disabled-button-toggle: $theme-dark-colors-surface-dim,
286 disabled-list-option: $theme-dark-colors-surface-dim,
287 raised-button: $dark-surface-primary,
288 focused-button: $dark-surface-primary-highlight,
289 selected-button: $theme-dark-colors-surface-dim,
290 selected-disabled-button: $theme-dark-colors-surface-dim,
291 unselected-chip: $theme-dark-colors-surface-variant,
292 tooltip: $theme-dark-colors-inverse-surface,
293 overlay: $theme-dark-colors-scrim,
294 accent: $dark-accent,
295 accent-highlight: $dark-surface-accent-highlight,
296 accent-highlight-hover: $dark-surface-accent-highlight-hover,
297 emphasis: $dark-emphasis,
298 emphasis-highlight: $dark-surface-emphasis-highlight,
299 emphasis-highlight-hover: $dark-surface-emphasis-highlight,
300 caution: $dark-surface-caution,
301 caution-highlight: $dark-surface-caution-highlight,
302 caution-highlight-hover: $dark-surface-caution-highlight-hover,
303 negative: $dark-surface-negative,
304 negative-highlight: $dark-surface-negative-highlight,
305 negative-highlight-hover: $dark-surface-negative-highlight-hover,
306 neutral: $dark-surface-neutral,
307 neutral-highlight: $dark-surface-neutral-highlight,
308 neutral-highlight-hover: $dark-surface-neutral-highlight-hover,
309 positive: $dark-surface-positive,
310 positive-highlight: $dark-surface-positive-highlight,
311 positive-highlight-hover: $dark-surface-positive-highlight-hover,
312 primary: $dark-surface-primary,
313 primary-highlight: $dark-surface-primary-highlight,
314 primary-highlight-hover: $dark-surface-primary-highlight-hover,
315);
316
317// Foreground palette for dark themes.
318// todo: need to re-catalog used variables
319$td-dark-theme-foreground: (
320 base: $dark-on-background,
321 divider: $dark-divider,
322 dividers: $dark-divider,
323 disabled: $theme-dark-colors-on-surface-38,
324 disabled-button: $theme-dark-colors-on-surface-38,
325 disabled-text: $theme-dark-colors-on-surface-38,
326 elevation: black,
327 // todo: need to work out elevation
328 hint-text: $theme-dark-colors-on-surface-variant,
329 secondary-text: $theme-dark-colors-on-surface-variant,
330 icon: $dark-text-icon-on-background,
331 icons: $dark-text-icon-on-background,
332 inverse-on-surface: $theme-dark-colors-inverse-on-surface,
333 text: $dark-on-surface,
334 slider-min: $dark-on-surface,
335 slider-off: $theme-dark-colors-on-surface-8,
336 slider-off-active: $theme-dark-colors-on-surface-16,
337 accent: $theme-dark-colors-on-primary,
338 emphasis: $theme-dark-colors-on-emphasis,
339 caution: $theme-dark-colors-on-caution,
340 negative: $theme-dark-colors-on-negative,
341 neutral: $dark-on-surface,
342 // todo: need to work out on-neutral tokens
343 positive: $theme-dark-colors-on-positive,
344 primary: $theme-dark-colors-on-primary,
345);
346
347// Custom typography
348$td-custom-typography: mat.define-typography-config(
349 $button: mat.define-typography-level(14px, 14px, 400),
350);
351$td-custom-toolbar-typography: mat.define-typography-config(
352 $headline-6: mat.define-typography-level(20px, 32px, 400),
353);
354
355// Create the theme object (a Sass map containing all of the palettes).
356$td-light-theme: mat.define-light-theme(
357 (
358 color: (
359 primary: mat.define-palette($td-primary, '40', '30', '60'),
360 secondary: mat.define-palette($td-secondary, '40', '30', '60'),
361 accent: mat.define-palette($td-accent, '40', '30', '60'),
362 warn: mat.define-palette($td-warn, '40', '30', '60'),
363 on-secondary: $light-on-secondary,
364 ),
365 typography: $td-custom-typography,
366 )
367);
368$td-light-theme: mat.private-deep-merge-all(
369 $td-light-theme,
370 (
371 color: (
372 background: $td-light-theme-background,
373 foreground: $td-light-theme-foreground,
374 ),
375 )
376);
377
378$td-dark-theme: mat.define-dark-theme(
379 (
380 color: (
381 primary: mat.define-palette($td-primary-dark, '80', '70', '90'),
382 secondary: mat.define-palette($td-secondary-dark, '80', '70', '90'),
383 accent: mat.define-palette($td-accent-dark, '80', '70', '90'),
384 warn: mat.define-palette($td-warn-dark, '80', '70', '90'),
385 on-secondary: $dark-on-secondary,
386 ),
387 typography: $td-custom-typography,
388 )
389);
390$td-dark-theme: mat.private-deep-merge-all(
391 $td-dark-theme,
392 (
393 color: (
394 background: $td-dark-theme-background,
395 foreground: $td-dark-theme-foreground,
396 ),
397 )
398);
399
400@mixin css-variable-theme-tokens($theme, $prefix: 'cv') {
401 @each $key, $value in $theme {
402 --#{$prefix}-theme-#{$key}: #{map-get($theme, $key)};
403 }
404}
405
406@mixin teradata-brand($theme) {
407 $primary: map-get($theme, primary);
408 $accent: map-get($theme, accent);
409 $warn: map-get($theme, warn);
410 $background: map-get(map-get($theme, color), background);
411 $foreground: map-get($theme, foreground);
412 $is-dark-theme: map-get($theme, is-dark);
413 $accent-highlight: map-get($background, accent-highlight);
414 $accent-highlight-hover: map-get($background, accent-highlight-hover);
415 $on-primary: map-get($foreground, primary);
416 $on-accent: map-get($foreground, accent);
417
418 .mat-toolbar.mat-primary {
419 --mat-toolbar-container-text-color: #{$on-primary};
420 }
421
422 :root {
423 --mdc-list-list-item-leading-avatar-color: #{map-get(
424 $background,
425 disabled-button
426 )};
427
428 @include css-variable-theme-tokens($td-light-colors);
429 }
430
431 .theme-dark {
432 @include css-variable-theme-tokens($td-dark-colors);
433 }
434
435 // Logo alignment
436 .mat-icon.mat-icon-logo {
437 fill: $teradata-orange-500;
438 position: relative;
439 top: -2px;
440
441 @if $is-dark-theme {
442 fill: #ffffff;
443 }
444 }
445 // Spacing before logo in main toolbar
446 .mat-toolbar {
447 .mdc-icon-button + .mat-icon-logo,
448 .mdc-icon-button + span > .mat-icon-logo {
449 margin-left: 10px;
450 }
451
452 .mat-icon-logo {
453 margin-right: 16px;
454 }
455 }
456 // Logo in card title alignment
457 .mat-card-title {
458 .mat-icon-logo {
459 margin-right: 8px;
460 }
461 }
462
463 // Apply theme for this app
464 body::after {
465 content: '';
466 position: absolute;
467 top: 0;
468 height: 2px;
469 width: 100%;
470 z-index: 999;
471 background-color: mat-color($accent);
472 }
473
474 // Active icon color in list nav
475 .mat-drawer {
476 mat-nav-list {
477 .mat-list-item {
478 &.active {
479 font-weight: bold;
480 color: $on-accent;
481
482 .mat-icon.mat-list-avatar {
483 background-color: mat-color($accent);
484 color: mat-color($accent);
485 fill: mat-color($accent);
486 }
487
488 .mat-icon.mat-list-icon {
489 color: mat-color($accent);
490 fill: mat-color($accent);
491 }
492 }
493 }
494
495 &[dense] {
496 .mat-icon.mat-list-avatar {
497 min-width: 36px;
498 }
499 }
500 }
501 }
502
503 // Active icon color in list nav
504 mat-nav-list {
505 [mat-list-item].active {
506 mat-icon[matListItemAvatar] {
507 background-color: mat-color($accent);
508 color: mat-color($accent);
509 }
510
511 mat-icon[matListIcon] {
512 color: mat-color($accent);
513 }
514 }
515 }
516
517 // Active side nav
518 .doc-nav a.doc-nav-link {
519 &.active::before {
520 background-color: mat-color($accent);
521 }
522
523 &:hover {
524 &::before {
525 background-color: mat-color($accent);
526 }
527 }
528 }
529
530 // Links
531 a {
532 text-decoration: none;
533 color: mat-color($accent);
534 }
535
536 .tc-td-secondary {
537 color: map-get($foreground, secondary-text);
538 }
539}