5
5
6
6
$_typography-properties : (font , font-family , line-height , font-size , letter-spacing , font-weight );
7
7
8
+ /// Gets the m2-config from the theme.
9
+ @function _get-m2-config ($theme ) {
10
+ $internal : map .get ($theme , _mat-theming-internals-do-not-access , m2-config );
11
+ @return $internal or $theme ;
12
+ }
13
+
8
14
/// Gets the type of theme represented by a theme object (light or dark).
9
15
/// @param {Map} $theme The theme
10
16
/// @return {String} The type of theme (either `light` or `dark`).
11
17
@function get-theme-type ($theme ) {
18
+ $theme : _get-m2-config ($theme );
12
19
@if not theme-has ($theme , color ) {
13
20
@error ' Color information is not available on this theme.' ;
14
21
}
@@ -26,6 +33,7 @@ $_typography-properties: (font, font-family, line-height, font-size, letter-spac
26
33
/// interpreted as a palette name).
27
34
/// @return {Color} The requested theme color.
28
35
@function get-theme-color ($theme , $palette-name , $args ... ) {
36
+ $theme : _get-m2-config ($theme );
29
37
@if not theme-has ($theme , color ) {
30
38
@error ' Color information is not available on this theme.' ;
31
39
}
@@ -44,6 +52,7 @@ $_typography-properties: (font, font-family, line-height, font-size, letter-spac
44
52
/// (font, font-family, font-size, font-weight, line-height, or letter-spacing).
45
53
/// @return {*} The value of the requested font property.
46
54
@function get-theme-typography ($theme , $typescale , $property ) {
55
+ $theme : _get-m2-config ($theme );
47
56
@if not theme-has ($theme , typography ) {
48
57
@error ' Typography information is not available on this theme.' ;
49
58
}
@@ -79,14 +88,20 @@ $_typography-properties: (font, font-family, line-height, font-size, letter-spac
79
88
/// @param {Map} $theme The theme
80
89
/// @return {Number} The density scale.
81
90
@function get-theme-density ($theme ) {
91
+ $theme : _get-m2-config ($theme );
82
92
@if not theme-has ($theme , density ) {
83
93
@error ' Density information is not available on this theme.' ;
84
94
}
85
95
$scale : theming .get-density-config ($theme );
86
96
@return theming .clamp-density ($scale , -5 );
87
97
}
88
98
99
+ /// Checks whether the theme has information about given theming system.
100
+ /// @param {Map} $theme The theme
101
+ /// @param {String} $system The system to check
102
+ /// @param {Boolean} Whether the theme has information about the system.
89
103
@function theme-has ($theme , $system ) {
104
+ $theme : _get-m2-config ($theme );
90
105
$theme : theming .private-legacy-get-theme ($theme );
91
106
@if $system == base {
92
107
@return true;
0 commit comments