source: trip-planner-front/node_modules/@angular/material/slide-toggle/_slide-toggle-theme.scss@ eed0bf8

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

initial commit

  • Property mode set to 100644
File size: 3.6 KB
Line 
1@use 'sass:map';
2@use '../core/style/private';
3@use '../core/theming/palette';
4@use '../core/theming/theming';
5@use '../core/typography/typography';
6@use '../core/typography/typography-utils';
7
8@mixin _checked-color($palette, $thumb-checked-hue) {
9 &.mat-checked {
10 .mat-slide-toggle-thumb {
11 background-color: theming.get-color-from-palette($palette, $thumb-checked-hue);
12 }
13
14 .mat-slide-toggle-bar {
15 // Opacity is determined from the specs for the selection controls.
16 // See: https://material.io/design/components/selection-controls.html#specs
17 background-color: theming.get-color-from-palette($palette, $thumb-checked-hue, 0.54);
18 }
19
20 .mat-ripple-element {
21 // Set no opacity for the ripples because the ripple opacity will be adjusted dynamically
22 // based on the type of interaction with the slide-toggle (e.g. for hover, focus)
23 background-color: theming.get-color-from-palette($palette, $thumb-checked-hue);
24 }
25 }
26}
27
28@mixin color($config-or-theme) {
29 $config: theming.get-color-config($config-or-theme);
30 $is-dark: map.get($config, is-dark);
31 $primary: map.get($config, primary);
32 $accent: map.get($config, accent);
33 $warn: map.get($config, warn);
34 $background: map.get($config, background);
35 $foreground: map.get($config, foreground);
36
37 // Color hues are based on the specs which briefly show the hues that are applied to a switch.
38 // The 2018 specs no longer describe how dark switches should look like. Due to the lack of
39 // information for dark themed switches, we partially keep the old behavior that is based on
40 // the previous specifications. For the checked color we always use the `default` hue because
41 // that follows MDC and also makes it easier for people to create a custom theme without needing
42 // to specify each hue individually.
43 $thumb-unchecked-hue: if($is-dark, 400, 50);
44 $thumb-checked-hue: default;
45
46 $bar-unchecked-color: theming.get-color-from-palette($foreground, disabled);
47 $ripple-unchecked-color: theming.get-color-from-palette($foreground, base);
48
49 .mat-slide-toggle {
50 @include _checked-color($accent, $thumb-checked-hue);
51
52 &.mat-primary {
53 @include _checked-color($primary, $thumb-checked-hue);
54 }
55
56 &.mat-warn {
57 @include _checked-color($warn, $thumb-checked-hue);
58 }
59
60 &:not(.mat-checked) .mat-ripple-element {
61 // Set no opacity for the ripples because the ripple opacity will be adjusted dynamically
62 // based on the type of interaction with the slide-toggle (e.g. for hover, focus)
63 background-color: $ripple-unchecked-color;
64 }
65 }
66
67 .mat-slide-toggle-thumb {
68 @include private.private-theme-elevation(1, $config);
69 background-color: theming.get-color-from-palette(palette.$grey-palette, $thumb-unchecked-hue);
70 }
71
72 .mat-slide-toggle-bar {
73 background-color: $bar-unchecked-color;
74 }
75}
76
77@mixin typography($config-or-theme) {
78 $config: typography.private-typography-to-2014-config(
79 theming.get-typography-config($config-or-theme));
80 .mat-slide-toggle-content {
81 font-family: typography-utils.font-family($config);
82 }
83}
84
85@mixin _density($config-or-theme) {}
86
87@mixin theme($theme-or-color-config) {
88 $theme: theming.private-legacy-get-theme($theme-or-color-config);
89 @include theming.private-check-duplicate-theme-styles($theme, 'mat-slide-toggle') {
90 $color: theming.get-color-config($theme);
91 $density: theming.get-density-config($theme);
92 $typography: theming.get-typography-config($theme);
93
94 @if $color != null {
95 @include color($color);
96 }
97 @if $density != null {
98 @include _density($density);
99 }
100 @if $typography != null {
101 @include typography($typography);
102 }
103 }
104}
105
Note: See TracBrowser for help on using the repository browser.