|
39 | 39 | border-color: mat-color($foreground, disabled-text);
|
40 | 40 | }
|
41 | 41 |
|
42 |
| - .mat-tab-group, .mat-tab-nav-bar { |
43 |
| - &.mat-primary { |
44 |
| - @include _mat-tabs-color($primary); |
45 |
| - |
46 |
| - &.mat-background-primary { |
47 |
| - @include _mat-tabs-color($primary, $primary); |
48 |
| - } |
| 42 | + // Remove header border when there is a background color |
| 43 | + .mat-tab-group[class*='mat-background-'] .mat-tab-header, |
| 44 | + .mat-tab-nav-bar[class*='mat-background-'] { |
| 45 | + border-bottom: none; |
| 46 | + border-top: none; |
| 47 | + } |
49 | 48 |
|
50 |
| - &.mat-background-accent { |
51 |
| - @include _mat-tabs-color($primary, $accent); |
52 |
| - } |
| 49 | + .mat-tab-group, .mat-tab-nav-bar { |
53 | 50 |
|
54 |
| - &.mat-background-warn { |
55 |
| - @include _mat-tabs-color($primary, $warn); |
56 |
| - } |
| 51 | + // Set the foreground color of the tabs |
| 52 | + &.mat-primary { |
| 53 | + @include _mat-tab-label-focus($primary); |
| 54 | + @include _mat-ink-bar($primary); |
57 | 55 | }
|
58 | 56 |
|
59 | 57 | &.mat-accent {
|
60 |
| - @include _mat-tabs-color($accent); |
| 58 | + @include _mat-tab-label-focus($accent); |
| 59 | + @include _mat-ink-bar($accent); |
| 60 | + } |
61 | 61 |
|
62 |
| - &.mat-background-primary { |
63 |
| - @include _mat-tabs-color($accent, $primary); |
64 |
| - } |
| 62 | + &.mat-warn { |
| 63 | + @include _mat-tab-label-focus($warn); |
| 64 | + @include _mat-ink-bar($warn); |
| 65 | + } |
65 | 66 |
|
66 |
| - &.mat-background-accent { |
67 |
| - @include _mat-tabs-color($accent, $accent); |
68 |
| - } |
| 67 | + // Set background color of the tabs and override focus color |
| 68 | + &.mat-background-primary { |
| 69 | + @include _mat-tab-label-focus($primary); |
| 70 | + @include _mat-tabs-background($primary); |
| 71 | + } |
69 | 72 |
|
70 |
| - &.mat-background-warn { |
71 |
| - @include _mat-tabs-color($accent, $warn); |
72 |
| - } |
| 73 | + &.mat-background-accent { |
| 74 | + @include _mat-tab-label-focus($accent); |
| 75 | + @include _mat-tabs-background($accent); |
73 | 76 | }
|
74 | 77 |
|
75 |
| - &.mat-warn { |
76 |
| - @include _mat-tabs-color($warn); |
| 78 | + &.mat-background-warn { |
| 79 | + @include _mat-tab-label-focus($warn); |
| 80 | + @include _mat-tabs-background($warn); |
| 81 | + } |
77 | 82 |
|
78 |
| - &.mat-background-primary { |
79 |
| - @include _mat-tabs-color($warn, $primary); |
80 |
| - } |
| 83 | + // Override inkbar color when theme color and background are the same |
| 84 | + &.mat-primary.mat-background-primary { |
| 85 | + @include _mat-ink-bar($primary, default-contrast); |
| 86 | + } |
81 | 87 |
|
82 |
| - &.mat-background-accent { |
83 |
| - @include _mat-tabs-color($warn, $accent); |
84 |
| - } |
| 88 | + &.mat-accent.mat-background-accent { |
| 89 | + @include _mat-ink-bar($accent, default-contrast); |
| 90 | + } |
85 | 91 |
|
86 |
| - &.mat-background-warn { |
87 |
| - @include _mat-tabs-color($warn, $warn); |
88 |
| - } |
| 92 | + &.mat-warn.mat-background-warn { |
| 93 | + @include _mat-ink-bar($warn, default-contrast); |
89 | 94 | }
|
90 | 95 | }
|
91 | 96 | }
|
92 | 97 |
|
93 |
| -@mixin _mat-tabs-color($color, $background-color: null) { |
94 |
| - |
95 |
| - $tab-focus-color: if($background-color, $background-color, $color); |
| 98 | +@mixin _mat-ink-bar($color, $hue: default) { |
| 99 | + .mat-ink-bar { |
| 100 | + background-color: mat-color($color, $hue); |
| 101 | + } |
| 102 | +} |
96 | 103 |
|
97 |
| - // Focus the tab label |
| 104 | +@mixin _mat-tab-label-focus($tab-focus-color) { |
98 | 105 | .mat-tab-label:focus, .mat-tab-link:focus {
|
99 | 106 | background-color: mat-color($tab-focus-color, lighter, 0.3);
|
100 | 107 | }
|
| 108 | +} |
101 | 109 |
|
102 |
| - // Set the ink bar to the theme color or default-contrast if |
103 |
| - // the theme color and background color are the same |
104 |
| - .mat-ink-bar { |
105 |
| - background-color: mat-color($color); |
106 |
| - |
107 |
| - @if $background-color == $color { |
108 |
| - background-color: mat-color($background-color, default-contrast); |
109 |
| - } |
| 110 | +@mixin _mat-tabs-background($background-color) { |
| 111 | + // Set background color for the tab group |
| 112 | + .mat-tab-header, .mat-tab-links { |
| 113 | + background-color: mat-color($background-color); |
110 | 114 | }
|
111 | 115 |
|
112 |
| - @if $background-color { |
113 |
| - // Set background color for the tab group |
114 |
| - .mat-tab-header, .mat-tab-links { |
115 |
| - background-color: mat-color($background-color); |
116 |
| - } |
117 |
| - |
118 |
| - // Set labels to contrast against background |
119 |
| - .mat-tab-label, .mat-tab-link { |
120 |
| - color: mat-color($background-color, default-contrast); |
121 |
| - |
122 |
| - &.mat-tab-disabled { |
123 |
| - color: mat-color($background-color, default-contrast, 0.4); |
124 |
| - } |
125 |
| - } |
| 116 | + // Set labels to contrast against background |
| 117 | + .mat-tab-label, .mat-tab-link { |
| 118 | + color: mat-color($background-color, default-contrast); |
126 | 119 |
|
127 |
| - // Set pagination chevrons to contrast background |
128 |
| - .mat-tab-header-pagination-chevron { |
129 |
| - border-color: mat-color($background-color, default-contrast); |
| 120 | + &.mat-tab-disabled { |
| 121 | + color: mat-color($background-color, default-contrast, 0.4); |
130 | 122 | }
|
| 123 | + } |
131 | 124 |
|
132 |
| - .mat-tab-header-pagination-disabled .mat-tab-header-pagination-chevron { |
133 |
| - border-color: mat-color($background-color, default-contrast, 0.4); |
134 |
| - } |
| 125 | + // Set pagination chevrons to contrast background |
| 126 | + .mat-tab-header-pagination-chevron { |
| 127 | + border-color: mat-color($background-color, default-contrast); |
| 128 | + } |
135 | 129 |
|
136 |
| - // Remove header border |
137 |
| - .mat-tab-header { |
138 |
| - border-bottom: none; |
139 |
| - border-top: none; |
140 |
| - } |
| 130 | + .mat-tab-header-pagination-disabled .mat-tab-header-pagination-chevron { |
| 131 | + border-color: mat-color($background-color, default-contrast, 0.4); |
141 | 132 | }
|
142 | 133 | }
|
143 | 134 |
|
|
0 commit comments