2

Please, can you explain me why I do have so big difference in the colors between my sketch design and what I see on my iphone simulator? In this case, I was using background picture from sketch and it was not changed at all but the difference is huge. How can I make it look the same?

enter image description here

mugx
  • 9,869
  • 3
  • 43
  • 55
Juri
  • 93
  • 8
  • how do you use this color inside the app? – Vyacheslav Jan 25 '18 at 21:43
  • It is just a picture of the background. let imageViewBg = UIImageView(image: UIImage(named: "MenuBg")) tableView.backgroundView = imageViewBg – Juri Jan 25 '18 at 21:44
  • Have you tried to reopen saved image in macos preview? It might be that you saved this file in web-safe colors. – Vyacheslav Jan 25 '18 at 21:48
  • Vyacheslav do you speak Russian? ;) – Juri Jan 25 '18 at 21:53
  • Yes, I can. But this forum is in English. Use https://ru.stackoverflow.com/ to ask in Russian. – Vyacheslav Jan 25 '18 at 21:55
  • No English is fine. Yes I did open image on my mac and it looks like on my iPhone simulator not like on the sketch. The funny thing I used colour picker to get background colour from sketch image and placed it into the code and it is still a huge difference. Is it possible that sketch does not show correct colours? – Juri Jan 25 '18 at 22:01
  • Try to change a color scheme – Vyacheslav Jan 25 '18 at 22:10

1 Answers1

8

I guess may be a problem related to the color space, Sketch documentation and here. So basically Sketch uses by default the Unmanaged color profile, which means your system’s default color profile — ‘Color LCD’ on a MacBook Pro for example:

enter image description here

Instead on Xcode you should have sRGB IEC61966-2.1, to be able to change the color you should touch the color selection of the UIView that you have to modify, eg:

  1. here the color selection:

enter image description here

  1. then you should see this cake:

enter image description here

  1. touch on the second button on the top bar

enter image description here

  1. then you'll have the possibility to change the color space:

enter image description here

Of course it's possible to do the same thing by code, since you have to mess with CGColorSpaceModel and color transformations, it's just a bit more verbose.


So, before to export (Sketch) and run on simulator (Xcode), a solution might be check to have selected on both applications the same color space: sRGB IEC61966-2.1.

Community
  • 1
  • 1
mugx
  • 9,869
  • 3
  • 43
  • 55
  • Thanks for the explanation. I did set up it in Sketch. How can I do it in my Xcode? – Juri Jan 25 '18 at 22:13