source: trip-planner-front/node_modules/@angular/material/chips/_chips-theme.scss@ 6c1585f

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

initial commit

  • Property mode set to 100644
File size: 3.3 KB
Line 
1@use 'sass:map';
2@use 'sass:meta';
3@use '../core/style/private';
4@use '../core/theming/theming';
5@use '../core/typography/typography';
6@use '../core/typography/typography-utils';
7
8$chip-remove-font-size: 18px;
9
10@mixin _element-color($foreground, $background) {
11 background-color: $background;
12 color: $foreground;
13
14 .mat-chip-remove {
15 color: $foreground;
16 opacity: 0.4;
17 }
18}
19
20
21// Applies the background color for a ripple element.
22// If the color value provided is not a Sass color,
23// we assume that we've been given a CSS variable.
24// Since we can't perform alpha-blending on a CSS variable,
25// we instead add the opacity directly to the ripple element.
26@mixin _ripple-background($palette, $default-contrast, $opacity) {
27 $background-color: theming.get-color-from-palette($palette, $default-contrast, $opacity);
28 background-color: $background-color;
29 @if (meta.type-of($background-color) != color) {
30 opacity: $opacity;
31 }
32}
33
34@mixin _palette-styles($palette) {
35 @include _element-color(theming.get-color-from-palette($palette, default-contrast),
36 theming.get-color-from-palette($palette));
37
38 .mat-ripple-element {
39 @include _ripple-background($palette, default-contrast, 0.1);
40 }
41}
42
43@mixin color($config-or-theme) {
44 $config: theming.get-color-config($config-or-theme);
45 $is-dark-theme: map.get($config, is-dark);
46 $primary: map.get($config, primary);
47 $accent: map.get($config, accent);
48 $warn: map.get($config, warn);
49 $background: map.get($config, background);
50 $foreground: map.get($config, foreground);
51
52 $unselected-background: theming.get-color-from-palette($background, unselected-chip);
53 $unselected-foreground: theming.get-color-from-palette($foreground, text);
54
55 .mat-chip.mat-standard-chip {
56 @include _element-color($unselected-foreground, $unselected-background);
57
58 &:not(.mat-chip-disabled) {
59 &:active {
60 @include private.private-theme-elevation(3, $config);
61 }
62
63 .mat-chip-remove:hover {
64 opacity: 0.54;
65 }
66 }
67
68 &.mat-chip-disabled {
69 opacity: 0.4;
70 }
71
72 &::after {
73 background: map.get($foreground, base);
74 }
75 }
76
77 .mat-chip.mat-standard-chip.mat-chip-selected {
78 &.mat-primary {
79 @include _palette-styles($primary);
80 }
81
82 &.mat-warn {
83 @include _palette-styles($warn);
84 }
85
86 &.mat-accent {
87 @include _palette-styles($accent);
88 }
89 }
90}
91
92@mixin typography($config-or-theme) {
93 $config: typography.private-typography-to-2014-config(
94 theming.get-typography-config($config-or-theme));
95 .mat-chip {
96 font-size: typography-utils.font-size($config, body-2);
97 font-weight: typography-utils.font-weight($config, body-2);
98
99 .mat-chip-trailing-icon.mat-icon,
100 .mat-chip-remove.mat-icon {
101 font-size: $chip-remove-font-size;
102 }
103 }
104}
105
106@mixin _density($config-or-theme) {}
107
108@mixin theme($theme-or-color-config) {
109 $theme: theming.private-legacy-get-theme($theme-or-color-config);
110 @include theming.private-check-duplicate-theme-styles($theme, 'mat-chips') {
111 $color: theming.get-color-config($theme);
112 $density: theming.get-density-config($theme);
113 $typography: theming.get-typography-config($theme);
114
115 @if $color != null {
116 @include color($color);
117 }
118 @if $density != null {
119 @include _density($density);
120 }
121 @if $typography != null {
122 @include typography($typography);
123 }
124 }
125}
126
127
Note: See TracBrowser for help on using the repository browser.