material-foundation / material-theme-builder

Visualize dynamic color and create a custom Material Theme.
https://material-foundation.github.io/material-theme-builder/
Apache License 2.0
397 stars 27 forks source link

Material Theme Builder Web - Export Android Views - custom color values same for unharmonized and harmonized #41

Closed tonyhallett closed 2 years ago

tonyhallett commented 2 years ago

Describe the bug Export - Android Views has the same style item values in themes.xml for custom color regardless of whether checked "Harmonize" or not.

To Reproduce Steps to reproduce the behavior:

  1. Go to https://material-foundation.github.io/material-theme-builder/#/custom
  2. Click on 'Add a Color'
  3. Add a custom color - e.g 183, 115, 48
  4. Export / Android Views
  5. Check Harmonize
  6. Export / Android Views
  7. Compare the values - they are the same.

Expected behavior They should be different.

Desktop (please complete the following information):

Additional context The values exported agree with the unharmonized values from copying the values directly from the webpage. Assuming that this is correct ( I have yet to calculate myself with the harmonize function ) then you are always exporting the unharmonized values despite <item name="harmonizeColor99">true</item>

material-theme.zip material-theme-uh.zip

jwill commented 2 years ago

The value exported will always be the source color because we have to support runtime harmonization.

See https://codelabs.developers.google.com/harmonize-color-android-views#6 and the MaterialColors class for more info.

Works as intended.

Closing issue.