OK, long story short:
- I'm using (embedded into the bundle) FontAwesome
- I'm using it as the font in some custom
NSButton
s - In the
NSButton
subclass I want to colour them, exactly the way the Xcode tab items are coloured
This is how I'm setting the color (as a simple NSColor):
NSColor *color = [NSColor colorWithCalibratedRed:0.09 green:0.55 blue:0.90 alpha:1.0];
NSMutableAttributedString *colorTitle =
[[NSMutableAttributedString alloc] initWithAttributedString:[self attributedTitle]];
NSRange titleRange = NSMakeRange(0, [colorTitle length]);
[colorTitle addAttribute:NSForegroundColorAttributeName
value:color
range:titleRange];
[self setAttributedTitle:colorTitle];
How can I set it to an NSGradient
?