PageRenderTime 19ms CodeModel.GetById 11ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/core/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
19#import "GTMDefines.h"
20#import <Cocoa/Cocoa.h>
21
22#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
23
24enum {
25  GTMColorationBaseHighlight,
26  GTMColorationBaseMidtone,
27  GTMColorationBaseShadow,
28  GTMColorationBasePenumbra,
29  GTMColorationLightHighlight,
30  GTMColorationLightMidtone,
31  GTMColorationLightShadow,
32  GTMColorationLightPenumbra,
33  GTMColorationDarkHighlight,
34  GTMColorationDarkMidtone,
35  GTMColorationDarkShadow,
36  GTMColorationDarkPenumbra
37};
38typedef NSUInteger GTMColorationUse;
39
40@interface NSColorSpace (GTMNSColorSpaceLuminanceHelpers)
41+ (NSColorSpace *)gtm_labColorSpace;
42@end
43
44@interface NSColor (GTMLuminanceAdditions)
45- (CGFloat)gtm_luminance;
46
47// Create a color modified by lightening or darkening it (-1.0 to 1.0)
48- (NSColor *)gtm_colorByAdjustingLuminance:(CGFloat)luminance;
49
50// Create a color modified by lightening or darkening it (-1.0 to 1.0)
51- (NSColor *)gtm_colorByAdjustingLuminance:(CGFloat)luminance
52                                saturation:(CGFloat)saturation;
53
54// Returns a color adjusted for a specific usage
55- (NSColor *)gtm_colorAdjustedFor:(GTMColorationUse)use;
56- (NSColor *)gtm_colorAdjustedFor:(GTMColorationUse)use faded:(BOOL)fade;
57
58// Returns whether the color is in the dark half of the spectrum
59- (BOOL)gtm_isDarkColor;
60
61// Returns a color that is legible on this color. (Nothing to do with textColor)
62- (NSColor *)gtm_legibleTextColor;
63@end
64
65#endif