source: trip-planner-front/node_modules/@angular/material/slider/_slider-theme.scss@ ceaed42

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

initial commit

  • Property mode set to 100644
File size: 6.0 KB
Line 
1@use 'sass:map';
2@use 'sass:meta';
3@use '../core/theming/theming';
4@use '../core/typography/typography';
5@use '../core/typography/typography-utils';
6
7@mixin _inner-content-theme($palette) {
8 .mat-slider-track-fill,
9 .mat-slider-thumb,
10 .mat-slider-thumb-label {
11 background-color: theming.get-color-from-palette($palette);
12 }
13
14 .mat-slider-thumb-label-text {
15 color: theming.get-color-from-palette($palette, default-contrast);
16 }
17
18 .mat-slider-focus-ring {
19 $opacity: 0.2;
20 $color: theming.get-color-from-palette($palette, default, $opacity);
21 background-color: $color;
22
23 // `mat-color` uses `rgba` for the opacity which won't work with
24 // CSS variables so we need to use `opacity` as a fallback.
25 @if (meta.type-of($color) != color) {
26 opacity: $opacity;
27 }
28 }
29}
30
31@mixin color($config-or-theme) {
32 $config: theming.get-color-config($config-or-theme);
33 $primary: map.get($config, primary);
34 $accent: map.get($config, accent);
35 $warn: map.get($config, warn);
36 $background: map.get($config, background);
37 $foreground: map.get($config, foreground);
38
39 $mat-slider-off-color: theming.get-color-from-palette($foreground, slider-off);
40 $mat-slider-off-focused-color: theming.get-color-from-palette($foreground, slider-off-active);
41 $mat-slider-disabled-color: theming.get-color-from-palette($foreground, slider-off);
42 $mat-slider-labeled-min-value-thumb-color:
43 theming.get-color-from-palette($foreground, slider-min);
44 $mat-slider-labeled-min-value-thumb-label-color:
45 theming.get-color-from-palette($foreground, slider-off);
46 $mat-slider-tick-opacity: 0.7;
47 $mat-slider-tick-color:
48 theming.get-color-from-palette($foreground, base, $mat-slider-tick-opacity);
49 $mat-slider-tick-size: 2px;
50
51 .mat-slider-track-background {
52 background-color: $mat-slider-off-color;
53 }
54
55 .mat-primary {
56 @include _inner-content-theme($primary);
57 }
58
59 .mat-accent {
60 @include _inner-content-theme($accent);
61 }
62
63 .mat-warn {
64 @include _inner-content-theme($warn);
65 }
66
67 .mat-slider:hover,
68 .mat-slider.cdk-focused {
69 .mat-slider-track-background {
70 background-color: $mat-slider-off-focused-color;
71 }
72 }
73
74 .mat-slider-disabled {
75 .mat-slider-track-background,
76 .mat-slider-track-fill,
77 .mat-slider-thumb {
78 background-color: $mat-slider-disabled-color;
79 }
80
81 &:hover {
82 .mat-slider-track-background {
83 background-color: $mat-slider-disabled-color;
84 }
85 }
86 }
87
88 .mat-slider-min-value {
89 .mat-slider-focus-ring {
90 $opacity: 0.12;
91 $color: theming.get-color-from-palette($foreground, base, $opacity);
92 background-color: $color;
93
94 // `mat-color` uses `rgba` for the opacity which won't work with
95 // CSS variables so we need to use `opacity` as a fallback.
96 @if (meta.type-of($color) != color) {
97 opacity: $opacity;
98 }
99 }
100
101 &.mat-slider-thumb-label-showing {
102 .mat-slider-thumb,
103 .mat-slider-thumb-label {
104 background-color: $mat-slider-labeled-min-value-thumb-color;
105 }
106
107 &.cdk-focused {
108 .mat-slider-thumb,
109 .mat-slider-thumb-label {
110 background-color: $mat-slider-labeled-min-value-thumb-label-color;
111 }
112 }
113 }
114
115 &:not(.mat-slider-thumb-label-showing) {
116 .mat-slider-thumb {
117 border-color: $mat-slider-off-color;
118 background-color: transparent;
119 }
120
121 &:hover,
122 &.cdk-focused {
123 .mat-slider-thumb {
124 border-color: $mat-slider-off-focused-color;
125 }
126
127 &.mat-slider-disabled .mat-slider-thumb {
128 border-color: $mat-slider-disabled-color;
129 }
130 }
131 }
132 }
133
134 .mat-slider-has-ticks .mat-slider-wrapper::after {
135 border-color: $mat-slider-tick-color;
136
137 // `mat-color` uses `rgba` for the opacity which won't work with
138 // CSS variables so we need to use `opacity` as a fallback.
139 @if (meta.type-of($mat-slider-tick-color) != color) {
140 opacity: $mat-slider-tick-opacity;
141 }
142 }
143
144 .mat-slider-horizontal .mat-slider-ticks {
145 background-image: repeating-linear-gradient(to right, $mat-slider-tick-color,
146 $mat-slider-tick-color $mat-slider-tick-size, transparent 0, transparent);
147 // Firefox doesn't draw the gradient correctly with 'to right'
148 // (see https://bugzilla.mozilla.org/show_bug.cgi?id=1314319).
149 background-image: -moz-repeating-linear-gradient(0.0001deg, $mat-slider-tick-color,
150 $mat-slider-tick-color $mat-slider-tick-size, transparent 0, transparent);
151
152 // `mat-color` uses `rgba` for the opacity which won't work with
153 // CSS variables so we need to use `opacity` as a fallback.
154 @if (meta.type-of($mat-slider-tick-color) != color) {
155 opacity: $mat-slider-tick-opacity;
156 }
157 }
158
159 .mat-slider-vertical .mat-slider-ticks {
160 background-image: repeating-linear-gradient(to bottom, $mat-slider-tick-color,
161 $mat-slider-tick-color $mat-slider-tick-size, transparent 0, transparent);
162
163 // `mat-color` uses `rgba` for the opacity which won't work with
164 // CSS variables so we need to use `opacity` as a fallback.
165 @if (meta.type-of($mat-slider-tick-color) != color) {
166 opacity: $mat-slider-tick-opacity;
167 }
168 }
169}
170
171@mixin typography($config-or-theme) {
172 $config: typography.private-typography-to-2014-config(
173 theming.get-typography-config($config-or-theme));
174 .mat-slider-thumb-label-text {
175 font: {
176 family: typography-utils.font-family($config);
177 size: typography-utils.font-size($config, caption);
178 weight: typography-utils.font-weight($config, body-2);
179 }
180 }
181}
182
183@mixin _density($config-or-theme) {}
184
185@mixin theme($theme-or-color-config) {
186 $theme: theming.private-legacy-get-theme($theme-or-color-config);
187 @include theming.private-check-duplicate-theme-styles($theme, 'mat-slider') {
188 $color: theming.get-color-config($theme);
189 $density: theming.get-density-config($theme);
190 $typography: theming.get-typography-config($theme);
191
192 @if $color != null {
193 @include color($color);
194 }
195 @if $density != null {
196 @include _density($density);
197 }
198 @if $typography != null {
199 @include typography($typography);
200 }
201 }
202}
Note: See TracBrowser for help on using the repository browser.