material-theme-builder icon indicating copy to clipboard operation
material-theme-builder copied to clipboard

Extended colors in JSON should include generated tones

Open joezappie opened this issue 1 year ago • 4 comments

Is your feature request related to a problem? Please describe. The spec describes an "error" color, but I'd like to add extended colors for other states such as warn(orange), success(green), info(blue), which is a common design trend.

I'd like to take the export json and use in to generate tailwind theme colors. Extended colors however, only export the input value, where as a color like error gets the errorContainer/onErrorContainer/error/onError.

  "schemes": {
    "light": {
      "error": "#904A46",
      "onError": "#FFFFFF",
      "errorContainer": "#FFDAD7",
      "onErrorContainer": "#3B0909",
    },
   },
  "extendedColors": [
      {
        "name": "Warn",
        "color": "#CA6A34",
        "description": "",
        "harmonized": false
      }
    ],

Describe the solution you'd like I think extended colors should also get these properties as well.

  "schemes": {
    "light": {
      "warn": "#CA6A34",
      "onWarn": "#FFFFFF",
      "warnContainer": "#FFDBCB",
      "onWarnContainer": "#341100",
    },
   },

The figma plugin generates them, so it would be nice if they were included as well.

image

Describe alternatives you've considered Use the material-color-utilities library to generate them myself, but I'm not sure how to do that as theres almost no documentation on using it.

joezappie avatar Apr 12 '24 01:04 joezappie

For some reason there are two theme builders, the one you used doesn't generate custom colors, but use this link for an updated/beta(?) Theme Builder

etyarews avatar Apr 14 '24 14:04 etyarews

I just tried that, but it looks like the exported json file is identical to the figma export where the extended colors do not include the container/on colors or them as a palette (0-100).

Theyre "generated" but not actually exported:

image

Example json: material-theme.json

Good to see this tool describes which palette color is used, so I could use something to generate the palette and inject my own colors into the theme file in my tailwind plugin for the time being, but would be awesome to have this info in the json files already.

joezappie avatar Apr 14 '24 14:04 joezappie

Huh, I use compose and never looked at json. I expected them to have the same tokens, but apparently that's not the case. With json you at least get the ref tokens for primary, secondary, tertiary, surface and surface-variant, that's not the case with compose. See #262

etyarews avatar Apr 14 '24 16:04 etyarews