Prism icon indicating copy to clipboard operation
Prism copied to clipboard

add support for document color

Open griffin-stewie opened this issue 4 years ago • 12 comments

I added support for named document colors.

Steps to get name:

  1. Try to get name from document color
  2. Try to get alias color name
  3. Finally, use the color classifier.

I added to edit a name of document color inside colorNameChanged as well.

Consideration

My understanding is there was no "named document color" feature on Sketch itself when Prism came out. However now Sketch has "named document colors" since Sketch v53. So how to manage colors inside Prism is time to change MSColor based to MSColorAsset base.

It could be significant change so I didn't change now, but we may consider to change design.

Related Issue

#43

griffin-stewie avatar Mar 17 '20 09:03 griffin-stewie

Any chance these pull request could be actioned?

custa1200 avatar May 15 '20 04:05 custa1200

One issue with this @griffin-stewie is that if I have 2 named colors that happen to have the same hex value, the second color will be named the same as the first one. when using named colors there is always the chance of having multiple versions of the same color with the same name.

custa1200 avatar May 18 '20 00:05 custa1200

As an example the image has a transparent color which is White with 0 alpha, it is also naming the White at the bottom with 100 alpha Transparent. There is 2 greys as you can see too, the second one is named "Selected" in the named color list but it gets assigned Grey a second time.

CleanShot 2020-05-18 at 10 37 00@2x

custa1200 avatar May 18 '20 00:05 custa1200

@custa1200 Is what you're calling "Named Color" the content of this link? or what you named them on the Prism's artboard?

griffin-stewie avatar May 18 '20 14:05 griffin-stewie

@custa1200 I'm starting to get it.

As an example the image has a transparent color which is White with 0 alpha, it is also naming the White at the bottom with 100 alpha Transparent.

This case of bug is able to be fixed it easily.

There is 2 greys as you can see too, the second one is named "Selected" in the named color list but it gets assigned Grey a second time.

In this case, it will not be easy to fix due to the impact of the original implementation. I would try to fix but it would be breaking change.

griffin-stewie avatar May 18 '20 15:05 griffin-stewie

It's "almost" perfect. I also made a formatter for the Hex + Alpha too, I might do a pull request for that.

custa1200 avatar May 18 '20 23:05 custa1200

@griffin-stewie would the second one be worth doing and looking to add it to a 2.0 release?

custa1200 avatar May 19 '20 01:05 custa1200

@custa1200 Unfortunately, I'm just a contributor so I can't judge the release. I think I need to take a closer look at the sphere of influence where I feel it's a problem. I am willing to make changes to this Pull Request if the problem is less severe than I was concerned about.

griffin-stewie avatar May 19 '20 14:05 griffin-stewie

The owner hasn’t picked up your pull requests for a while :( should I spin this out to an issue to track outside this PR?

custa1200 avatar May 19 '20 14:05 custa1200

@custa1200 I pushed some commits to fix problem you mentioned. Could you try this?

griffin-stewie avatar May 22 '20 14:05 griffin-stewie

I tried it out and it worked a treat @griffin-stewie I would say that handles all the color naming issues for me.

custa1200 avatar May 24 '20 01:05 custa1200

@custa1200 I’m glad to hear it! Thank you for testing it.

griffin-stewie avatar May 24 '20 01:05 griffin-stewie