Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sketch color palette #285

Closed
ghost opened this issue May 30, 2019 · 2 comments
Closed

Sketch color palette #285

ghost opened this issue May 30, 2019 · 2 comments

Comments

@ghost
Copy link

ghost commented May 30, 2019

Hello,
I don't think I have an issue per say, but I'm having a hard time creating the sketch color palette via the transform function sketch/palette.
My scss works fine, Android and IOS too.
But as for the sketch palette, it creates an empty file with just

{
  "compatibleVersion": "1.0",
  "pluginVersion": "1.1",
  "colors": []
}

If there's another place I can ask, please forward me :-D

Thanks for your help,
M.

@dbanksdesign
Copy link
Member

dbanksdesign commented May 30, 2019

The 'sketch/palette' format filters tokens that have

{
  attribute: {
    category: 'color',
    type: 'base'
  }
}

Here is the source: https://github.com/amzn/style-dictionary/blob/master/lib/common/formats.js#L710

We recently-ish added 'filters' for you to filter your tokens before formatting them, so we should remove that filter in the format itself. In the meantime, if your tokens have those attributes (category === 'color' and type === 'base') it will work then. You can do this either by adding an attribute object on your tokens directly with those properties, or set up your tokens to be like this:

{
  "color": {
    "base": {
      "white": {
        //...

So the fix would be to remove the .filter code in the 'sketch/palette` format, and that is actually it. Once we do that, you will need to make sure to add a 'filter' in your file config to filter only the color tokens or you might get some weirdness.

@dbanksdesign
Copy link
Member

dbanksdesign commented May 30, 2019

A bit of a bigger issue, when trying out sketch palettes, I had an old version of the plugin so I needed to update it. The plugin is now a major version above (2.2 vs. 1.1), which has an impact on the format because now the .sketchpalette file takes a slightly different form. The new form looks like this:

{
  "compatibleVersion": "2.0",
  "pluginVersion": "2.22",
  "colors": [
    {
      "name": "test",
      "red": 0.847,
      "green": 0.847,
      "blue": 0.847,
      "alpha": 1
    }
  ],
  "gradients": [],
  "images": []
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant