3

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?

Dan Jiang
  • 89
  • 7
  • 1
    The 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 Answers3

0

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.

user3441734
  • 16,722
  • 2
  • 40
  • 59
0

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:

  1. Create an NSDictionary of brand-approved colors, indexed by what the color is used for (*text colors, background colors, button colors, etc).
  2. Add a "user-defined runtime attribute" in the InterfaceBuilder inspector, telling each view which colors to use.
  3. 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.
  4. 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.
Mark Bessey
  • 19,598
  • 4
  • 47
  • 69
0

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?

Community
  • 1
  • 1
Mark Bessey
  • 19,598
  • 4
  • 47
  • 69