I am using a \"spinner\" NSProgressIndicator in my cocoa app:
I would like to display it in a different color so that it will show up well on a dark backgr
For a more fine grained solution, you can use a polynomial color approach using the following Category. Please note that for simplicity I use only the x component of the vectors. For more accurate color matching please see reference at: https://developer.apple.com/library/ios/documentation/GraphicsImaging/Reference/CoreImageFilterReference/index.html#//apple_ref/doc/filter/ci/CIColorMatrix
@import QuartzCore;
#import
@interface NSProgressIndicator (Colors)
- (void)setCustomColor:(NSColor *)aColor;
@end
@implementation NSProgressIndicator (Colors)
- (void)setCustomColor:(NSColor *)aColor {
CIFilter *colorPoly = [CIFilter filterWithName:@"CIColorPolynomial"];
[colorPoly setDefaults];
CIVector *redVector = [CIVector vectorWithX:aColor.redComponent Y:0 Z:0 W:0];
CIVector *greenVector = [CIVector vectorWithX:aColor.greenComponent Y:0 Z:0 W:0];
CIVector *blueVector = [CIVector vectorWithX:aColor.blueComponent Y:0 Z:0 W:0];
[colorPoly setValue:redVector forKey:@"inputRedCoefficients"];
[colorPoly setValue:greenVector forKey:@"inputGreenCoefficients"];
[colorPoly setValue:blueVector forKey:@"inputBlueCoefficients"];
[self setContentFilters:[NSArray arrayWithObjects:colorPoly, nil]];
}
@end