Ticket #2262: invertedColor.diff
| File invertedColor.diff, 2.8 kB (added by freakman, 3 years ago) |
|---|
-
Frameworks/AIUtilities
old new 259 259 return ([[self colorUsingColorSpaceName:NSCalibratedRGBColorSpace] brightnessComponent] < 0.5); 260 260 } 261 261 262 - (BOOL)colorIsMedium 263 { 264 float brightness = [[self colorUsingColorSpaceName:NSCalibratedRGBColorSpace] brightnessComponent]; 265 return (0.35 < brightness && brightness < 0.65); 266 } 267 262 268 //Percent should be -1.0 to 1.0 (negatives will make the color brighter) 263 269 - (NSColor *)darkenBy:(float)amount 264 270 { … … 313 319 return [NSColor colorWithCalibratedHue:h luminance:l saturation:s alpha:1.0]; 314 320 } 315 321 322 - (NSColor *)invertedColor 323 { 324 return [self colorIsMedium] ? ([self colorIsDark] ? [NSColor whiteColor] : [NSColor blackColor]) : [NSColor colorWithCalibratedRed:1.0 - [self redComponent] 325 green:1.0 - [self greenComponent] 326 blue:1.0 - [self blueComponent] 327 alpha:1.0]; 328 } 329 316 330 - (void)getHue:(float *)hue luminance:(float *)luminance saturation:(float *)saturation 317 331 { 318 332 NSColor *rgbColor; -
Frameworks/AIUtilities
old new 39 39 + (NSControlTint)currentControlTintSupportingJag; 40 40 - (BOOL)equalToRGBColor:(NSColor *)inColor; 41 41 - (BOOL)colorIsDark; 42 - (BOOL)colorIsMedium; 42 43 - (NSColor *)darkenBy:(float)amount; 43 44 - (NSColor *)darkenAndAdjustSaturationBy:(float)amount; 44 45 - (NSString *)hexString; … … 46 47 - (void)getHue:(float *)hue luminance:(float *)luminance saturation:(float *)saturation; 47 48 + (NSColor *)colorWithCalibratedHue:(float)hue luminance:(float)luminance saturation:(float)saturation alpha:(float)alpha; 48 49 - (NSColor *)colorWithInvertedLuminance; 50 - (NSColor *)invertedColor; 49 51 - (NSColor *)adjustHue:(float)dHue saturation:(float)dSat brightness:(float)dBrit; 50 52 51 53 //these use arc4random() for their random numbers. there is no need to seed anything. -
Frameworks/Adium
old new 354 354 [self setBackgroundColor:cachedWhiteColor]; 355 355 } 356 356 357 [self setInsertionPointColor:[backgroundColor colorWithInvertedLuminance]];357 [self setInsertionPointColor:[backgroundColor invertedColor]]; 358 358 } 359 359 360 360 //Paste as rich text without altering our typing attributes