source: trip-planner-front/node_modules/@angular/material/tabs/_tabs-theme.scss@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 5.3 KB
Line 
1@use 'sass:map';
2@use '../core/theming/theming';
3@use '../core/typography/typography';
4@use '../core/typography/typography-utils';
5
6@mixin color($config-or-theme) {
7 $config: theming.get-color-config($config-or-theme);
8 $primary: map.get($config, primary);
9 $accent: map.get($config, accent);
10 $warn: map.get($config, warn);
11 $background: map.get($config, background);
12 $foreground: map.get($config, foreground);
13 $header-border: 1px solid theming.get-color-from-palette($foreground, divider);
14
15 .mat-tab-nav-bar,
16 .mat-tab-header {
17 border-bottom: $header-border;
18 }
19
20 .mat-tab-group-inverted-header {
21 .mat-tab-nav-bar,
22 .mat-tab-header {
23 border-top: $header-border;
24 border-bottom: none;
25 }
26 }
27
28 .mat-tab-label, .mat-tab-link {
29 color: theming.get-color-from-palette($foreground, text);
30
31 &.mat-tab-disabled {
32 color: theming.get-color-from-palette($foreground, disabled-text);
33 }
34 }
35
36 .mat-tab-header-pagination-chevron {
37 border-color: theming.get-color-from-palette($foreground, text);
38 }
39
40 .mat-tab-header-pagination-disabled .mat-tab-header-pagination-chevron {
41 border-color: theming.get-color-from-palette($foreground, disabled-text);
42 }
43
44 // Remove header border when there is a background color
45 .mat-tab-group[class*='mat-background-'] > .mat-tab-header,
46 .mat-tab-nav-bar[class*='mat-background-'] {
47 border-bottom: none;
48 border-top: none;
49 }
50
51 .mat-tab-group, .mat-tab-nav-bar {
52 $theme-colors: (
53 primary: $primary,
54 accent: $accent,
55 warn: $warn
56 );
57
58 @each $name, $color in $theme-colors {
59 // Set the foreground color of the tabs
60 &.mat-#{$name} {
61 @include _label-focus-color($color);
62 @include _ink-bar-color($color);
63
64 // Override ink bar when background color is the same
65 &.mat-background-#{$name} {
66 > .mat-tab-header, > .mat-tab-link-container {
67 @include _ink-bar-color($color, default-contrast);
68 }
69 }
70 }
71 }
72
73 @each $name, $color in $theme-colors {
74 // Set background color of the tabs and override focus color
75 &.mat-background-#{$name} {
76 @include _label-focus-color($color);
77 @include _tabs-background($color);
78 }
79 }
80 }
81}
82
83@mixin _ink-bar-color($color, $hue: default) {
84 .mat-ink-bar {
85 background-color: theming.get-color-from-palette($color, $hue);
86 }
87}
88
89@mixin _label-focus-color($tab-focus-color) {
90 .mat-tab-label,
91 .mat-tab-link {
92 &.cdk-keyboard-focused,
93 &.cdk-program-focused {
94 &:not(.mat-tab-disabled) {
95 background-color: theming.get-color-from-palette($tab-focus-color, lighter, 0.3);
96 }
97 }
98 }
99}
100
101@mixin _tabs-background($background-color) {
102 // Note that these selectors target direct descendants so
103 // that the styles don't apply to any nested tab groups.
104
105 // Set background color for the tab group
106 > .mat-tab-header, > .mat-tab-link-container, > .mat-tab-header-pagination {
107 background-color: theming.get-color-from-palette($background-color);
108 }
109
110 // Set labels to contrast against background
111 > .mat-tab-header .mat-tab-label, > .mat-tab-link-container .mat-tab-link {
112 color: theming.get-color-from-palette($background-color, default-contrast);
113
114 &.mat-tab-disabled {
115 color: theming.get-color-from-palette($background-color, default-contrast, 0.4);
116 }
117 }
118
119 // Set pagination chevrons to contrast background
120 > .mat-tab-header .mat-tab-header-pagination-chevron,
121 > .mat-tab-header-pagination .mat-tab-header-pagination-chevron,
122 > .mat-tab-link-container .mat-focus-indicator::before,
123 > .mat-tab-header .mat-focus-indicator::before {
124 border-color: theming.get-color-from-palette($background-color, default-contrast);
125 }
126
127 > .mat-tab-header .mat-tab-header-pagination-disabled .mat-tab-header-pagination-chevron,
128 > .mat-tab-header-pagination-disabled .mat-tab-header-pagination-chevron {
129 border-color: theming.get-color-from-palette($background-color, default-contrast, 0.4);
130 }
131
132 // Set ripples color to be the contrast color of the new background. Otherwise the ripple
133 // color will be based on the app background color.
134 > .mat-tab-header .mat-ripple-element,
135 > .mat-tab-link-container .mat-ripple-element,
136 > .mat-tab-header-pagination .mat-ripple-element {
137 background-color: theming.get-color-from-palette($background-color, default-contrast, 0.12);
138 }
139}
140
141@mixin typography($config-or-theme) {
142 $config: typography.private-typography-to-2014-config(
143 theming.get-typography-config($config-or-theme));
144 .mat-tab-group {
145 font-family: typography-utils.font-family($config);
146 }
147
148 .mat-tab-label, .mat-tab-link {
149 font: {
150 family: typography-utils.font-family($config, button);
151 size: typography-utils.font-size($config, button);
152 weight: typography-utils.font-weight($config, button);
153 }
154 }
155}
156
157@mixin _density($config-or-theme) {}
158
159@mixin theme($theme-or-color-config) {
160 $theme: theming.private-legacy-get-theme($theme-or-color-config);
161 @include theming.private-check-duplicate-theme-styles($theme, 'mat-tabs') {
162 $color: theming.get-color-config($theme);
163 $density: theming.get-density-config($theme);
164 $typography: theming.get-typography-config($theme);
165
166 @if $color != null {
167 @include color($color);
168 }
169 @if $density != null {
170 @include _density($density);
171 }
172 @if $typography != null {
173 @include typography($typography);
174 }
175 }
176}
Note: See TracBrowser for help on using the repository browser.