55
66$_typography-properties : (font , font-family , line-height , font-size , letter-spacing , font-weight );
77
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+
814/// Gets the type of theme represented by a theme object (light or dark).
915/// @param {Map} $theme The theme
1016/// @return {String} The type of theme (either `light` or `dark`).
1117@function get-theme-type ($theme ) {
18+ $theme : _get-m2-config ($theme );
1219 @if not theme-has ($theme , color ) {
1320 @error ' Color information is not available on this theme.' ;
1421 }
@@ -26,6 +33,7 @@ $_typography-properties: (font, font-family, line-height, font-size, letter-spac
2633/// interpreted as a palette name).
2734/// @return {Color} The requested theme color.
2835@function get-theme-color ($theme , $palette-name , $args ... ) {
36+ $theme : _get-m2-config ($theme );
2937 @if not theme-has ($theme , color ) {
3038 @error ' Color information is not available on this theme.' ;
3139 }
@@ -44,6 +52,7 @@ $_typography-properties: (font, font-family, line-height, font-size, letter-spac
4452/// (font, font-family, font-size, font-weight, line-height, or letter-spacing).
4553/// @return {*} The value of the requested font property.
4654@function get-theme-typography ($theme , $typescale , $property ) {
55+ $theme : _get-m2-config ($theme );
4756 @if not theme-has ($theme , typography ) {
4857 @error ' Typography information is not available on this theme.' ;
4958 }
@@ -79,14 +88,20 @@ $_typography-properties: (font, font-family, line-height, font-size, letter-spac
7988/// @param {Map} $theme The theme
8089/// @return {Number} The density scale.
8190@function get-theme-density ($theme ) {
91+ $theme : _get-m2-config ($theme );
8292 @if not theme-has ($theme , density ) {
8393 @error ' Density information is not available on this theme.' ;
8494 }
8595 $scale : theming .get-density-config ($theme );
8696 @return theming .clamp-density ($scale , -5 );
8797}
8898
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.
89103@function theme-has ($theme , $system ) {
104+ $theme : _get-m2-config ($theme );
90105 $theme : theming .private-legacy-get-theme ($theme );
91106 @if $system == base {
92107 @return true;
0 commit comments