Is there any possible way to set global tint color in OS X. If I want to set brand color on Cocoa control like NSTabView. How cloud I do it?
-
1The user can set a control tint color in System Settings / General. It's not for "app branding", since it applies to all apps, and you can also only choose between "Blue" and "Graphite". – Aderstedt Nov 18 '15 at 12:58
-
http://stackoverflow.com/a/28617708/1463604 – Nishant Nov 18 '15 at 12:59
3 Answers
if you need to change it in your app
class NSAppearance : NSObject, NSCoding Description An NSAppearance object represents a file that specifies a standard appearance that applies to a subset of UI elements in an app. An app can contain multiple appearance files and—because NSAppearance conforms to NSCoding—you can use Interface Builder to assign UI elements to an appearance.

- 16,722
- 2
- 40
- 59
We needed to do this for an application that wanted to have a very-similar appearance between the Windows and Mac OS X versions (don't judge me - it's what the customers want). What we ended up doing is more-or-less:
- Create an NSDictionary of brand-approved colors, indexed by what the color is used for (*text colors, background colors, button colors, etc).
- Add a "user-defined runtime attribute" in the InterfaceBuilder inspector, telling each view which colors to use.
- Write a category on NSView (and a few other Appkit views) that implements a setter for that attribute, which then calls -setBackgroundColor: or whatever other AppKit API you need to change the default colors.
- Since -setBackgroundColor: is only available on views that have a Core Animation layer, we ended up adding code to our NSView property setter to call -setWantsLayer:YES on every view which needed a non-default background color.

- 19,598
- 4
- 47
- 69
Another approach is to create an "Appearance file", which you can load to override the visual appearance of AppKit controls. This is not a very well documented process, but see this related StackOverflow question/answer for details. How can I make an "appearance file" for NSAppearance?

- 1
- 1

- 19,598
- 4
- 47
- 69
-
Thanks. I got the basic idea about what to do. It`s not easy as iOS. – Dan Jiang Nov 19 '15 at 08:52