Getting color from a NSColorWell in CGColorCreateGenericRGB

866 views Asked by At

I am trying to set the background color of an NSTextField like this

myTF.layer.layer.backgroundColor = [myColorWell color]

But I am getting an error

What is the beat way to get the color from a NSColorWell and set it to my NSTextField's backgroundColor?

I hope i have to conver the color i got from the NSColorWell and convert to either CGColorCreateGenericRGB or CGColorRef so that i can set the background

Can anybody please guide me?

1

There are 1 answers

0
user226372 On

Got it's pretty easy

myTF.layer.backgroundColor = [myColor CGColor];