Skip to content

Instantly share code, notes, and snippets.

@akamud
Created March 17, 2018 16:45
Show Gist options
  • Save akamud/7788c70db32127c1a6330f898482a3f9 to your computer and use it in GitHub Desktop.
Save akamud/7788c70db32127c1a6330f898482a3f9 to your computer and use it in GitHub Desktop.
Color extensions to fix iOS Color Space
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