/core/externals/update-engine/externals/google-toolbox-for-mac/AppKit/GTMNSColor+Luminance.h

http://macfuse.googlecode.com/ · C++ Header · 65 lines · 32 code · 11 blank · 22 comment · 0 complexity · 2b085e3dbbf39e3bc9e42664b70f9783 MD5 · raw file

  1. //
  2. // GTMNSColor+Luminance.h
  3. //
  4. // Copyright 2009 Google Inc.
  5. //
  6. // Licensed under the Apache License, Version 2.0 (the "License"); you may not
  7. // use this file except in compliance with the License. You may obtain a copy
  8. // of the License at
  9. //
  10. // http://www.apache.org/licenses/LICENSE-2.0
  11. //
  12. // Unless required by applicable law or agreed to in writing, software
  13. // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  14. // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  15. // License for the specific language governing permissions and limitations under
  16. // the License.
  17. //
  18. #import "GTMDefines.h"
  19. #import <Cocoa/Cocoa.h>
  20. #if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
  21. enum {
  22. GTMColorationBaseHighlight,
  23. GTMColorationBaseMidtone,
  24. GTMColorationBaseShadow,
  25. GTMColorationBasePenumbra,
  26. GTMColorationLightHighlight,
  27. GTMColorationLightMidtone,
  28. GTMColorationLightShadow,
  29. GTMColorationLightPenumbra,
  30. GTMColorationDarkHighlight,
  31. GTMColorationDarkMidtone,
  32. GTMColorationDarkShadow,
  33. GTMColorationDarkPenumbra
  34. };
  35. typedef NSUInteger GTMColorationUse;
  36. @interface NSColorSpace (GTMNSColorSpaceLuminanceHelpers)
  37. + (NSColorSpace *)gtm_labColorSpace;
  38. @end
  39. @interface NSColor (GTMLuminanceAdditions)
  40. - (CGFloat)gtm_luminance;
  41. // Create a color modified by lightening or darkening it (-1.0 to 1.0)
  42. - (NSColor *)gtm_colorByAdjustingLuminance:(CGFloat)luminance;
  43. // Create a color modified by lightening or darkening it (-1.0 to 1.0)
  44. - (NSColor *)gtm_colorByAdjustingLuminance:(CGFloat)luminance
  45. saturation:(CGFloat)saturation;
  46. // Returns a color adjusted for a specific usage
  47. - (NSColor *)gtm_colorAdjustedFor:(GTMColorationUse)use;
  48. - (NSColor *)gtm_colorAdjustedFor:(GTMColorationUse)use faded:(BOOL)fade;
  49. // Returns whether the color is in the dark half of the spectrum
  50. - (BOOL)gtm_isDarkColor;
  51. // Returns a color that is legible on this color. (Nothing to do with textColor)
  52. - (NSColor *)gtm_legibleTextColor;
  53. @end
  54. #endif