Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
Created attachment 16713 [details]
Test project where the bug can be observed
We have a custom renderer for ContentView, which draws a rounded corners view.
The color is set in PCL, so on iOS it should be converted from Forms.Color to CGColor for drawing.
We found out, that converting the color using extension method toCGColor() and method toUIColor().CGColor produces different results on iOS 9.3 (on other versions the colors are converted equally). And the result, produced by toCGColor() is the wrong one (comparing to setting the color as background for ContentView).
You can reproduce this by running attached test project on a device or a simulator with iOS version 9.3.
iOS 9.3 added support for color management, which may be causing this.
I can confirm that this is happening.
iOS 8.4 screenshot: https://www.dropbox.com/s/kdnra6sahx180e3/Screenshot%202016-07-19%2016.41.17.png?dl=0
iOS 9.3 screenshot: https://www.dropbox.com/s/4ohjawait073ll9/Screenshot%202016-07-19%2016.42.20.png?dl=0
I can confirm this too:
e.g. Element.StartColor is a Forms.Color property. Following two lines should have same result:
However, 1) returns a wrong value. 2) is correct.
I verified result by using manually convert the value:
CGColor ToCGColor(Color color)
UIKit.UIColor uicolor = new UIKit.UIColor(
This bug is caused because the conversion to a CGColor() from a Color uses the kCGColorSpaceGenericRGB color space, while going through UIKit's UIColor uses the kCGColorSpaceExtendedSRGB.
Basically, new UIColor (r, g, b, a) and new CGColor(r,g,b) do not produce CGColors in the same colorspace.
From the documentation: https://developer.apple.com/documentation/uikit/uicolor
The UIColor is created on the Device-Dependent RGB color space (which changes across versions and more recently on iOS 10 and higher, does not even clamp the values from 0..1) while CGColor is by default created in the generic RGB color space which is more limited.
For reference: http://tirania.org/blog/archive/2017/Dec-07.html