I have a NSButton
checkbox style and want to change the background color in the checkbox, both when state is .on and when state is off. Similar to the calendars list in macOS Calendar app.
Any hints on how to do that?
A NSButton
with checkbox style consist of a checkbox and some text. If I set the background color of the NSButton everything BUT the checkbox is changed to have the color. That is the text gets the background color but the check box still have white background when unchecked and blue background when checked.
If you want to change the color of a CheckBox, you need to use contentTintColor
starting from macOS 11.
let button = NSButton(checkboxWithTitle: "", target: self, action: #selector(checkBoxToggled))
button.contentTintColor = NSColor.orange