Skip to content
This repository has been archived by the owner on Sep 6, 2018. It is now read-only.

SwiftGen generate the wrong color code for iOS when parsing sRGB color space #20

Closed
yusuke024 opened this issue Apr 6, 2017 · 2 comments
Assignees
Milestone

Comments

@yusuke024
Copy link

I have a .clr files for my iOS project which contains color in sRGB color space (which is used by iOS). But SwiftGen converts these color into NSCalibratedColorSpace (which I believe is called Generic RGB in the color panel) before generating the code which is not what I want. So, are there any reasons SwiftGen has to convert the color to NSCalibratedColorSpace before generating the code. And can we add an option to convert it to other color space/profile like "sRGB IEC61966-2.1"?

@djbe
Copy link
Member

djbe commented Apr 6, 2017

Aha, I've hit the same issue, but never had the time to look into it. Colors from JSON don't have this problem, but those don't have colorspace information.

I wonder what the best solution would be?

  • Always convert to sRGB IEC61966-2.1 if it isn't yet --> I know that's the default one for iOS, but what about the other platforms
  • Parse the color space information and provide it to the template --> Use the correct initializer

@yusuke024
Copy link
Author

yusuke024 commented Apr 6, 2017

I think we should just parse the values as-is without converting it to any color space. iOS developers will probably have .clr files in sRGB while macOS developers will have it in Generic RGB. Then SwiftGen will convert them to the right ones for the platform depending on the .clr that were passed to it. And the color code in the palettes file will match the generated code which is the expected behavior.

And I just tested it, even if you have mixed color spaces in a .clr file, it will give the same color code as in the file if you don't convert it to any color space after.

@djbe djbe self-assigned this Apr 16, 2017
@djbe djbe added this to the 2.0.0 milestone Aug 20, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants