I just started learning swift and I am trying to create an app that changes the color of the background based on the color selected in the NSColorPanel in the NSToolbar.
When clicking on Colors I am faced a Color Palette. Now what I can't figure out is how to extract/read the Color Codes in Swift.
I have looked all over the internet but unfortunately nothing was helpful.
Hopefully someone here can provide with more information.

First you need to add an observer for when the color panel has changed colors.
where
colorPanelDidChangeis your custom method:In this method, you extract the content of the notification:
and now you can do
cp.colorto get the actual color the user has clicked on.