So here are the colors I am trying to convert from UIColor to CGColor:
Here is the Blue vs. iOS's rendering: a: b:
Here is the Red vs. iOS's rendering: a b:
Here is the code I am using to convert the colors: Red:
[[UIColor colorWithRed:202 green:0 blue:11 alpha:1] CGColor]
Blue:
[[UIColor colorWithRed:0 green:19 blue:133 alpha:1] CGColor]
Does anyone know what I am doing wrong?
You need to divide the parameters by 255.0. As noted by @Duncan C, ensure you are dividing by 255.0
[[UIColor colorWithRed:202.0/255.0 green:0 blue:11/255.0 alpha:1] CGColor]
[[UIColor colorWithRed:0 green:19/255.0 blue:133/255.0 alpha:1] CGColor]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With