@@ -37,6 +37,108 @@ It includes the following information:
37
37
A ` DynamicScheme ` object does not store the ARGB or HCT values of individual
38
38
color roles; they are generated upon demand (see below for more information)
39
39
40
+ ## Migrating from ` Scheme `
41
+
42
+ The ` Scheme ` class will be deprecated soon, as it does not support different
43
+ contrast levels. The functionality of ` Scheme ` is fully replicated by
44
+ ` SchemeTonalSpot ` and ` SchemeContent ` .
45
+
46
+ <section >
47
+
48
+ ###### Dart
49
+
50
+ | Instead of … | Use … |
51
+ | ---------------------------- | ----------------------------------- |
52
+ | ` Scheme.light(color) ` | `SchemeTonalSpot(sourceColorHct: |
53
+ : : Hct.fromInt(color), isDark\: false, :
54
+ : : contrastLevel\: 0.0)` :
55
+ | ` Scheme.dark(color) ` | `SchemeTonalSpot(sourceColorHct: |
56
+ : : Hct.fromInt(color), isDark\: true, :
57
+ : : contrastLevel\: 0.0)` :
58
+ | ` Scheme.lightContent(color) ` | `SchemeContent(sourceColorHct: |
59
+ : : Hct.fromInt(color), isDark\: false, :
60
+ : : contrastLevel\: 0.0)` :
61
+ | ` Scheme.darkContent(color) ` | `SchemeContent(sourceColorHct: |
62
+ : : Hct.fromInt(color), isDark\: true, :
63
+ : : contrastLevel\: 0.0)` :
64
+
65
+ ###### Java
66
+
67
+ | Instead of … | Use … |
68
+ | ---------------------------- | --------------------------------------------- |
69
+ | ` Scheme.light(color) ` | `new SchemeTonalSpot(Hct.fromInt(color), |
70
+ : : false, 0.0)` :
71
+ | ` Scheme.dark(color) ` | `new SchemeTonalSpot(Hct.fromInt(color), |
72
+ : : true, 0.0)` :
73
+ | ` Scheme.lightContent(color) ` | `new SchemeContent(Hct.fromInt(color), false, |
74
+ : : 0.0)` :
75
+ | ` Scheme.darkContent(color) ` | `new SchemeContent(Hct.fromInt(color), true, |
76
+ : : 0.0)` :
77
+
78
+ ###### TypeScript
79
+
80
+ | Instead of … | Use … |
81
+ | ---------------------------- | --------------------------------------------- |
82
+ | ` Scheme.light(color) ` | `new SchemeTonalSpot(Hct.fromInt(color), |
83
+ : : false, 0.0)` :
84
+ | ` Scheme.dark(color) ` | `new SchemeTonalSpot(Hct.fromInt(color), |
85
+ : : true, 0.0)` :
86
+ | ` Scheme.lightContent(color) ` | `new SchemeContent(Hct.fromInt(color), false, |
87
+ : : 0.0)` :
88
+ | ` Scheme.darkContent(color) ` | `new SchemeContent(Hct.fromInt(color), true, |
89
+ : : 0.0)` :
90
+
91
+ ###### C++
92
+
93
+ | Instead of … | Use … |
94
+ | ---------------------------------------- | --------------------------------- |
95
+ | ` MaterialLightColorScheme(color) ` | `SchemeTonalSpot(Hct(color), |
96
+ : : false, 0.0)` :
97
+ | ` MaterialDarkColorScheme(color) ` | `SchemeTonalSpot(Hct(color), |
98
+ : : true, 0.0)` :
99
+ | ` MaterialLightContentColorScheme(color) ` | `SchemeContent(Hct(color), false, |
100
+ : : 0.0)` :
101
+ | ` MaterialDarkContentColorScheme(color) ` | `SchemeContent(Hct(color), true, |
102
+ : : 0.0)` :
103
+
104
+ ###### Swift
105
+
106
+ | Instead of … | Use … |
107
+ | ---------------------------- | ----------------------------------- |
108
+ | ` Scheme.light(color) ` | `SchemeTonalSpot(sourceColorHct: |
109
+ : : Hct.fromInt(color), isDark\: false, :
110
+ : : contrastLevel\: 0.0)` :
111
+ | ` Scheme.dark(color) ` | `SchemeTonalSpot(sourceColorHct: |
112
+ : : Hct.fromInt(color), isDark\: true, :
113
+ : : contrastLevel\: 0.0)` :
114
+ | ` Scheme.lightContent(color) ` | `SchemeContent(sourceColorHct: |
115
+ : : Hct.fromInt(color), isDark\: false, :
116
+ : : contrastLevel\: 0.0)` :
117
+ | ` Scheme.darkContent(color) ` | `SchemeContent(sourceColorHct: |
118
+ : : Hct.fromInt(color), isDark\: true, :
119
+ : : contrastLevel\: 0.0)` :
120
+
121
+ </section >
122
+
123
+ For ` Scheme.lightFromCorePalette ` and ` Scheme.darkFromCorePalette `
124
+ (` MaterialLightColorSchemeFromPalette ` and ` MaterialDarkColorSchemeFromPalette `
125
+ in C++), please use the ` DynamicScheme ` constructor instead.
126
+
127
+ Please see ** Step 2 — Obtaining colors** to obtain colors from a
128
+ ` DynamicScheme ` .
129
+
130
+ Due to an update in the specification, the values of many color roles have
131
+ changed between ` Scheme ` , and the new dynamic schemes ` SchemeTonalSpot ` and
132
+ ` SchemeContent ` . After migrating, you may need to update your tests.
133
+
134
+ For ` SchemeTonalSpot ` , color roles using the "primary" and "neutral" palettes,
135
+ such as ` onPrimary ` and ` outline ` , may be affected. Also, the roles ` background `
136
+ and ` surface ` have updated tones.
137
+
138
+ For ` SchemeContent ` , all colors may have been affected, because ` SchemeContent `
139
+ is a fidelity scheme: the tones of color roles may depend on the tone of the
140
+ seed color.
141
+
40
142
## Step 1 — Generating a scheme
41
143
42
144
### Method 1 — Using a variant
0 commit comments