Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Matching AppKit and SpriteKit colors

I am building a small utility app for macOS that combines SpriteKit with AppKit. Specifically, I am using an SKView as the "background" for the app window (mostly for specific types of animations that are easier in SpriteKit). I am also changing colors of the Window's background property to adjust the title bar color. Switching between green and red.

The issue I am running into is matching colors between AppKit and SpriteKit. In short, they don't match. As you can see in the image the title bar is a bit different than the SKView.

enter image description here

After a bit of playing, I found that the background color in the SKView is in the "Device RGB colorspace" and the Window's colors are in "sRGB IEC61966-2.1 colorspace." I changed the AppKit colors to device RGB and the colors still don't match.

I'm creating the colors with a regular old NSColor initializer.

I'm not sure if you can change the color space of a color. The backgroundColor property on the Window and SKView is read only.

Any ideas?

like image 325
Hartix Avatar asked Sep 29 '17 15:09

Hartix


1 Answers

if im reading this right what you are wanting to do is match colors could you not just do something like yourAppKit.backgroundColor = yourSKView.backgroundColor that should set them to equal

and my second question is do you need them to match? most of the time people arent gonna notice and if they do notice they wont really care

also here is some data on converting RGB to sRGB

like image 108
E. Huckabee Avatar answered Sep 21 '22 09:09

E. Huckabee