|
1 | 1 | @use '@angular/material' as mat; |
| 2 | +// @include mat.elevation-classes(); |
| 3 | +// @include mat.app-background(); |
2 | 4 |
|
3 | | -// Plus imports for other components in your app. |
4 | | - |
5 | | -// Disable legacy API compatibility, since dev-app is fully migrated to theme inspection API. |
6 | | -mat.$theme-legacy-inspection-api-compatibility: false; |
7 | | - |
8 | | -$primary: mat.$azure-palette; |
9 | | -$tertiary: mat.$blue-palette; |
10 | | - |
11 | | -// Create a theme with the specified color type and density. |
12 | | -@function create-theme($type: light, $density: 0) { |
13 | | - @return mat.define-theme(( |
| 5 | +$theme: mat.define-theme( |
| 6 | + ( |
14 | 7 | color: ( |
15 | | - theme-type: $type, |
16 | | - primary: $primary, |
17 | | - tertiary: $tertiary, |
18 | | - use-system-variables: true, |
19 | | - ), |
20 | | - typography: (use-system-variables: true), |
21 | | - density: ( |
22 | | - scale: $density |
| 8 | + theme-type: dark, |
| 9 | + primary: mat.$cyan-palette, |
| 10 | + tertiary: mat.$orange-palette, |
23 | 11 | ), |
24 | | - )); |
25 | | -} |
26 | | - |
27 | | -// Define the default (light) theme. |
28 | | -$light-theme: create-theme($type: light); |
29 | | - |
30 | | -// Create our dark theme. |
31 | | -$dark-theme: create-theme($type: dark); |
| 12 | + ) |
| 13 | +); |
32 | 14 |
|
33 | | -// Include the default theme styles. |
34 | 15 | html { |
35 | | - color-scheme: light; |
36 | | - body:not(.demo-experimental-theme) { |
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); |
43 | | - } |
44 | | - |
45 | | - body.demo-experimental-theme { |
46 | | - @include mat.theme(( |
47 | | - color: ( |
48 | | - primary: $primary, |
49 | | - tertiary: $tertiary, |
50 | | - ), |
51 | | - typography: Roboto, |
52 | | - density: 0, |
53 | | - )); |
54 | | - } |
55 | | -} |
56 | | - |
57 | | -@include mat.typography-hierarchy($light-theme); |
58 | | - |
59 | | -.demo-strong-focus { |
60 | | - // Note: we can theme the indicators directly through `strong-focus-indicators` as well. |
61 | | - // Use the theme so we have some coverage over the entire API surface. |
62 | | - @include mat.strong-focus-indicators(); |
63 | | - @include mat.strong-focus-indicators-theme($light-theme); |
64 | | -} |
65 | | - |
66 | | -// Include the alternative theme styles inside of a block with a CSS class. You can make this |
67 | | -// CSS class whatever you want. In this example, any component inside of an element with |
68 | | -// `.demo-unicorn-dark-theme` will be affected by this alternate dark theme instead of the |
69 | | -// default theme. |
70 | | -body.demo-unicorn-dark-theme { |
71 | | - color-scheme: dark; |
72 | | - &:not(.demo-experimental-theme) { |
73 | | - // Include the dark theme color styles. |
74 | | - @include mat.all-component-colors($dark-theme); |
75 | | - @include mat.system-level-colors($dark-theme); |
76 | | - // TODO(mmalerba): Support M3 for experimental components. |
77 | | - // @include matx.column-resize-color($dark-theme); |
78 | | - // @include matx.popover-edit-color($dark-theme); |
79 | | - } |
80 | | - |
81 | | - // Include the dark theme colors for focus indicators. |
82 | | - &.demo-strong-focus { |
83 | | - @include mat.strong-focus-indicators-color($dark-theme); |
84 | | - } |
85 | | -} |
86 | | - |
87 | | -// Create classes for all density scales which are supported by all MDC-based components. |
88 | | -// The classes are applied conditionally based on the selected density in the dev-app layout |
89 | | -// component. |
90 | | -$density-scales: (-1, -2, -3, -4, minimum, maximum); |
91 | | -@each $scale in $density-scales { |
92 | | - .demo-density-#{$scale} { |
93 | | - body:not(.demo-experimental-theme) & { |
94 | | - $density-theme: create-theme($density: $scale); |
95 | | - @include mat.all-component-densities($density-theme); |
| 16 | + // @include mat.all-component-themes($theme); |
| 17 | + // @include mat.typography-hierarchy($theme); |
| 18 | + @each $variant in (primary, secondary, tertiary, error) { |
| 19 | + .#{$variant}-button { |
| 20 | + @include mat.button-color($theme, $color-variant: $variant); |
96 | 21 | } |
97 | | - |
98 | | - body.demo-experimental-theme & { |
99 | | - @include mat.theme((density: $scale)); |
| 22 | + .#{$variant}-radio { |
| 23 | + @include mat.radio-color($theme, $color-variant: $variant); |
100 | 24 | } |
101 | 25 | } |
102 | | -} |
103 | | - |
104 | | -// Enable back-compat CSS for color="..." API & typography hierarchy. |
105 | | -.demo-color-api-back-compat { |
106 | | - @include mat.color-variants-backwards-compatibility($light-theme); |
107 | | - @include mat.typography-hierarchy($light-theme, $back-compat: true); |
108 | | - |
109 | | - &.demo-unicorn-dark-theme { |
110 | | - @include mat.color-variants-backwards-compatibility($dark-theme); |
| 26 | + body { |
| 27 | + margin: 0; |
111 | 28 | } |
112 | 29 | } |
113 | | - |
114 | | -// In M3 buttons are smaller than their touch target at zero-density. |
115 | | -.demo-config-buttons button { |
116 | | - margin: 4px; |
117 | | -} |
118 | | - |
119 | | -// In M3 we need some spacing around the list in the sidenav. |
120 | | -mat-nav-list.demo-nav-list { |
121 | | - margin: 8px; |
122 | | -} |
0 commit comments