Created
March 17, 2018 16:45
-
-
Save akamud/7788c70db32127c1a6330f898482a3f9 to your computer and use it in GitHub Desktop.
Color extensions to fix iOS Color Space
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class ColorExtensions | |
{ | |
public static UIColor ToCorrectUIColor(this Color color) | |
{ | |
return new UIColor(new CGColor(CGColorSpace.CreateSrgb(), new nfloat[] { (float)color.R, (float)color.G, (float)color.B, (float)color.A })); | |
} | |
public static CGColor ToCorrectCGColor(this Color color) | |
{ | |
return new CGColor(CGColorSpace.CreateSrgb(), new nfloat[] { (float)color.R, (float)color.G, (float)color.B, (float)color.A }); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment