Skip to content

Commit

Permalink
[M3][Color] Fix formatting and typos for resources harmonization.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 431682174
  • Loading branch information
Material Design Team authored and hunterstich committed Mar 1, 2022
1 parent 2ae676c commit d24b3a9
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions docs/theming/Color.md
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ an array of resource ids for the color resources you'd like to harmonize, a
HarmonizedColorsOptions options =
new HarmonizedColorsOptions.Builder(activity)
.setColorResourcesIds(colorResources)
.setColorAttributes(new HarmonizedColorAttributes.create(attributes))
.setColorAttributes(HarmonizedColorAttributes.create(attributes))
.setColorAttributeToHarmonizeWith(colorAttributeResId)
.build();
```
Expand Down Expand Up @@ -451,17 +451,19 @@ our theme overlay at `R.style.ThemeOverlay_Material3_HarmonizedColors`.

You can also use color resources harmonization separate from dynamic colors if
needed, but the general use case for color resources harmonization is after
dynamic colors have been applied. Here's an example use case to harmonize M3
Error colors by default in the Dynamic Colors callback:
dynamic colors have been applied, to ensure visual cohesion for reserved colors
(e.g. semantic colors) in a M3 theme with dynamic colors enabled. A Material
suggested default when applying dynamic colors, is to harmonize M3 Error colors
in the callback when constructing `DynamicColorsOptions`:

```
DynamicColorsOptions dynamicColorOptions =
new DynamicColorsOptions.Builder(activity)
...
.setOnAppliedCallback(
activity ->
HarmonizedColors.applyIfAvailable(
HarmonizedColorsOptions.createMaterialDefaults(activity)))
HarmonizedColors.applyIfAvailable(
HarmonizedColorsOptions.createMaterialDefaults(activity)))
.build()
DynamicColors.applyIfAvailable(dynamicColorOptions);
```
Expand Down

0 comments on commit d24b3a9

Please sign in to comment.