55// Disable legacy API compatibility, since dev-app is fully migrated to theme inspection API.
66mat .$theme-legacy-inspection-api-compatibility : false;
77
8+ $primary : mat .$azure-palette ;
9+ $tertiary : mat .$blue-palette ;
10+
811// Create a theme with the specified color type and density.
912@function create-theme ($type : light , $density : 0 ) {
1013 @return mat .define-theme ((
1114 color : (
1215 theme- type: $type ,
13- primary: mat . $azure-palette ,
14- tertiary: mat . $blue-palette ,
16+ primary: $primary ,
17+ tertiary: $tertiary ,
1518 use- system- variables: true,
1619 ),
1720 typography: (use- system- variables: true),
@@ -34,12 +37,26 @@ $dark-theme: create-theme($type: dark);
3437
3538// Include the default theme styles.
3639html {
37- @include mat .all-component-themes ($light-theme );
38- @include mat .system-level-colors ($light-theme );
39- @include mat .system-level-typography ($light-theme );
40- // TODO(mmalerba): Support M3 for experimental components.
41- // @include matx.column-resize-theme($light-theme);
42- // @include matx.popover-edit-theme($light-theme);
40+ body :not (.demo-experimental-theme ) {
41+ @include mat .all-component-themes ($light-theme );
42+ @include mat .system-level-colors ($light-theme );
43+ @include mat .system-level-typography ($light-theme );
44+ // TODO(mmalerba): Support M3 for experimental components.
45+ // @include matx.column-resize-theme($light-theme);
46+ // @include matx.popover-edit-theme($light-theme);
47+ }
48+
49+ body .demo-experimental-theme {
50+ @include mat .private-experimental-theme ((
51+ color : (
52+ theme- type: light ,
53+ primary: $primary ,
54+ tertiary: $tertiary ,
55+ ),
56+ typography: Roboto,
57+ density: 0 ,
58+ ));
59+ }
4360}
4461
4562@include mat .typography-hierarchy ($light-theme );
@@ -55,13 +72,25 @@ html {
5572// CSS class whatever you want. In this example, any component inside of an element with
5673// `.demo-unicorn-dark-theme` will be affected by this alternate dark theme instead of the
5774// default theme.
58- .demo-unicorn-dark-theme {
59- // Include the dark theme color styles.
60- @include mat .all-component-colors ($dark-theme );
61- @include mat .system-level-colors ($dark-theme );
62- // TODO(mmalerba): Support M3 for experimental components.
63- // @include matx.column-resize-color($dark-theme);
64- // @include matx.popover-edit-color($dark-theme);
75+ body .demo-unicorn-dark-theme {
76+ & :not (.demo-experimental-theme ) {
77+ // Include the dark theme color styles.
78+ @include mat .all-component-colors ($dark-theme );
79+ @include mat .system-level-colors ($dark-theme );
80+ // TODO(mmalerba): Support M3 for experimental components.
81+ // @include matx.column-resize-color($dark-theme);
82+ // @include matx.popover-edit-color($dark-theme);
83+ }
84+
85+ & .demo-experimental-theme {
86+ @include mat .private-experimental-theme ((
87+ color : (
88+ theme- type: dark ,
89+ primary: $primary ,
90+ tertiary: $tertiary ,
91+ ),
92+ ));
93+ }
6594
6695 // Include the dark theme colors for focus indicators.
6796 & .demo-strong-focus {
@@ -75,8 +104,14 @@ html {
75104$density-scales : (-1 , -2 , -3 , -4 , minimum, maximum);
76105@each $scale in $density-scales {
77106 .demo-density-#{$scale } {
78- $density-theme : create-theme ($density : $scale );
79- @include mat .all-component-densities ($density-theme );
107+ body :not (.demo-experimental-theme ) & {
108+ $density-theme : create-theme ($density : $scale );
109+ @include mat .all-component-densities ($density-theme );
110+ }
111+
112+ body .demo-experimental-theme & {
113+ @include mat .private-experimental-theme ((density: $scale ));
114+ }
80115 }
81116}
82117
0 commit comments