5
5
// Disable legacy API compatibility, since dev-app is fully migrated to theme inspection API.
6
6
mat .$theme-legacy-inspection-api-compatibility : false;
7
7
8
+ $primary : mat .$azure-palette ;
9
+ $tertiary : mat .$blue-palette ;
10
+
8
11
// Create a theme with the specified color type and density.
9
12
@function create-theme ($type : light , $density : 0 ) {
10
13
@return mat .define-theme ((
11
14
color : (
12
15
theme- type: $type ,
13
- primary: mat . $azure-palette ,
14
- tertiary: mat . $blue-palette ,
16
+ primary: $primary ,
17
+ tertiary: $tertiary ,
15
18
use- system- variables: true,
16
19
),
17
20
typography: (use- system- variables: true),
@@ -34,12 +37,26 @@ $dark-theme: create-theme($type: dark);
34
37
35
38
// Include the default theme styles.
36
39
html {
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
+ }
43
60
}
44
61
45
62
@include mat .typography-hierarchy ($light-theme );
@@ -55,13 +72,25 @@ html {
55
72
// CSS class whatever you want. In this example, any component inside of an element with
56
73
// `.demo-unicorn-dark-theme` will be affected by this alternate dark theme instead of the
57
74
// 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
+ }
65
94
66
95
// Include the dark theme colors for focus indicators.
67
96
& .demo-strong-focus {
@@ -75,8 +104,14 @@ html {
75
104
$density-scales : (-1 , -2 , -3 , -4 , minimum, maximum);
76
105
@each $scale in $density-scales {
77
106
.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
+ }
80
115
}
81
116
}
82
117
0 commit comments