Skip to content
Snippets Groups Projects
Commit b563ba98 authored by George Nachman's avatar George Nachman
Browse files

Add an escape hatch to the system color picker. Fix a bug where the color was...

Add an escape hatch to the system color picker. Fix a bug where the color was not saved in non-continuous pickers.
parent 83077578
No related branches found
No related tags found
No related merge requests found
Showing
with 188 additions and 43 deletions
No preview for this file type
ColorPicker/ColorPicker.framework/Versions/A/Resources/ActiveEscapeHatch.tiff

7.96 KiB

ColorPicker/ColorPicker.framework/Versions/A/Resources/EscapeHatch.tiff

7.86 KiB

Loading
Loading
@@ -20,22 +20,26 @@
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>6D570</string>
<string>7A1001</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>14D125</string>
<string>15A278</string>
<key>DTSDKName</key>
<string>macosx10.10</string>
<string>macosx10.11</string>
<key>DTXcode</key>
<string>0630</string>
<string>0701</string>
<key>DTXcodeBuild</key>
<string>6D570</string>
<string>7A1001</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2015 Google. All rights reserved.</string>
</dict>
Loading
Loading
Loading
Loading
@@ -7,6 +7,10 @@
objects = {
 
/* Begin PBXBuildFile section */
1D3368861BCDB60700D3B564 /* EscapeHatch.png in Resources */ = {isa = PBXBuildFile; fileRef = 1D3368841BCDB60700D3B564 /* EscapeHatch.png */; settings = {ASSET_TAGS = (); }; };
1D3368871BCDB60700D3B564 /* EscapeHatch@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1D3368851BCDB60700D3B564 /* EscapeHatch@2x.png */; settings = {ASSET_TAGS = (); }; };
1D33688B1BCDB62100D3B564 /* ActiveEscapeHatch.png in Resources */ = {isa = PBXBuildFile; fileRef = 1D3368891BCDB62100D3B564 /* ActiveEscapeHatch.png */; settings = {ASSET_TAGS = (); }; };
1D33688C1BCDB62100D3B564 /* ActiveEscapeHatch@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1D33688A1BCDB62100D3B564 /* ActiveEscapeHatch@2x.png */; settings = {ASSET_TAGS = (); }; };
A6184EAE1BA874020088EF3C /* ColorPicker.h in Headers */ = {isa = PBXBuildFile; fileRef = A6184EAD1BA874020088EF3C /* ColorPicker.h */; settings = {ATTRIBUTES = (Public, ); }; };
A6184EB41BA874020088EF3C /* ColorPicker.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A6184EA81BA874020088EF3C /* ColorPicker.framework */; };
A6184EBB1BA874020088EF3C /* ColorPickerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = A6184EBA1BA874020088EF3C /* ColorPickerTests.m */; };
Loading
Loading
@@ -93,6 +97,10 @@
/* End PBXContainerItemProxy section */
 
/* Begin PBXFileReference section */
1D3368841BCDB60700D3B564 /* EscapeHatch.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = EscapeHatch.png; path = Images.xcassets/EscapeHatch/EscapeHatch.png; sourceTree = "<group>"; };
1D3368851BCDB60700D3B564 /* EscapeHatch@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "EscapeHatch@2x.png"; path = "Images.xcassets/EscapeHatch/EscapeHatch@2x.png"; sourceTree = "<group>"; };
1D3368891BCDB62100D3B564 /* ActiveEscapeHatch.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ActiveEscapeHatch.png; path = Images.xcassets/ActiveEscapeHatch/ActiveEscapeHatch.png; sourceTree = "<group>"; };
1D33688A1BCDB62100D3B564 /* ActiveEscapeHatch@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "ActiveEscapeHatch@2x.png"; path = "Images.xcassets/ActiveEscapeHatch/ActiveEscapeHatch@2x.png"; sourceTree = "<group>"; };
A6184EA81BA874020088EF3C /* ColorPicker.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ColorPicker.framework; sourceTree = BUILT_PRODUCTS_DIR; };
A6184EAC1BA874020088EF3C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
A6184EAD1BA874020088EF3C /* ColorPicker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ColorPicker.h; sourceTree = "<group>"; };
Loading
Loading
@@ -107,9 +115,9 @@
A6184ED11BA874190088EF3C /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
A6184ED41BA874190088EF3C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
A6184EEC1BA876390088EF3C /* CPKMainViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPKMainViewController.h; sourceTree = "<group>"; };
A6184EED1BA876390088EF3C /* CPKMainViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPKMainViewController.m; sourceTree = "<group>"; };
A6184EED1BA876390088EF3C /* CPKMainViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = CPKMainViewController.m; sourceTree = "<group>"; };
A6184EF01BA876E50088EF3C /* CPKRGBView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPKRGBView.h; sourceTree = "<group>"; };
A6184EF11BA876E50088EF3C /* CPKRGBView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPKRGBView.m; sourceTree = "<group>"; };
A6184EF11BA876E50088EF3C /* CPKRGBView.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = CPKRGBView.m; sourceTree = "<group>"; };
A6184EF41BA87A770088EF3C /* CPKPopover.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPKPopover.h; sourceTree = "<group>"; };
A6184EF51BA87A770088EF3C /* CPKPopover.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPKPopover.m; sourceTree = "<group>"; };
A6184EF81BA8801D0088EF3C /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
Loading
Loading
@@ -128,7 +136,7 @@
A6184F181BA8F40C0088EF3C /* CPKEyedropperWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPKEyedropperWindow.h; sourceTree = "<group>"; };
A6184F191BA8F40C0088EF3C /* CPKEyedropperWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPKEyedropperWindow.m; sourceTree = "<group>"; };
A6184F1C1BA90BB40088EF3C /* CPKColorWell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPKColorWell.h; sourceTree = "<group>"; };
A6184F1D1BA90BB40088EF3C /* CPKColorWell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPKColorWell.m; sourceTree = "<group>"; };
A6184F1D1BA90BB40088EF3C /* CPKColorWell.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = CPKColorWell.m; sourceTree = "<group>"; };
A6184F201BA911980088EF3C /* CPKEyedropperView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPKEyedropperView.h; sourceTree = "<group>"; };
A6184F211BA911980088EF3C /* CPKEyedropperView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPKEyedropperView.m; sourceTree = "<group>"; };
A6184F2F1BA9D5700088EF3C /* Add.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Add.png; sourceTree = "<group>"; };
Loading
Loading
@@ -193,6 +201,24 @@
/* End PBXFrameworksBuildPhase section */
 
/* Begin PBXGroup section */
1D3368831BCDB5F600D3B564 /* EscapeHatch */ = {
isa = PBXGroup;
children = (
1D3368841BCDB60700D3B564 /* EscapeHatch.png */,
1D3368851BCDB60700D3B564 /* EscapeHatch@2x.png */,
);
name = EscapeHatch;
sourceTree = "<group>";
};
1D3368881BCDB61200D3B564 /* ActiveEscapeHatch */ = {
isa = PBXGroup;
children = (
1D3368891BCDB62100D3B564 /* ActiveEscapeHatch.png */,
1D33688A1BCDB62100D3B564 /* ActiveEscapeHatch@2x.png */,
);
name = ActiveEscapeHatch;
sourceTree = "<group>";
};
A6184E9E1BA874020088EF3C = {
isa = PBXGroup;
children = (
Loading
Loading
@@ -313,6 +339,8 @@
A6184F2D1BA9D55D0088EF3C /* Resources */ = {
isa = PBXGroup;
children = (
1D3368881BCDB61200D3B564 /* ActiveEscapeHatch */,
1D3368831BCDB5F600D3B564 /* EscapeHatch */,
A6184F831BAA93F50088EF3C /* ActiveEyedropper */,
A6184F7E1BAA928A0088EF3C /* Eyedropper */,
A6184F2E1BA9D5700088EF3C /* Add */,
Loading
Loading
@@ -532,16 +560,20 @@
A6184F421BA9D5700088EF3C /* SelectedColorIndicator@2x.png in Resources */,
A6184F821BAA928A0088EF3C /* Eyedropper@2x.png in Resources */,
A6184F3E1BA9D5700088EF3C /* Add@2x.png in Resources */,
1D3368871BCDB60700D3B564 /* EscapeHatch@2x.png in Resources */,
A6184F6D1BAA15B80088EF3C /* SelectionIndicator.png in Resources */,
A6184F811BAA928A0088EF3C /* Eyedropper.png in Resources */,
A6184F3D1BA9D5700088EF3C /* Add.png in Resources */,
A6184F6E1BAA15B80088EF3C /* SelectionIndicator@2x.png in Resources */,
A6184F871BAA93F50088EF3C /* ActiveEyedropper@2x.png in Resources */,
A6184F5D1BAA083F0088EF3C /* SwatchCheckerboard@2x.png in Resources */,
1D33688B1BCDB62100D3B564 /* ActiveEscapeHatch.png in Resources */,
A6184F5C1BAA083F0088EF3C /* SwatchCheckerboard.png in Resources */,
1D3368861BCDB60700D3B564 /* EscapeHatch.png in Resources */,
A6184F761BAA2AC60088EF3C /* Remove@2x.png in Resources */,
A6184F411BA9D5700088EF3C /* SelectedColorIndicator.png in Resources */,
A6184F861BAA93F50088EF3C /* ActiveEyedropper.png in Resources */,
1D33688C1BCDB62100D3B564 /* ActiveEscapeHatch@2x.png in Resources */,
A6184F481BA9D75B0088EF3C /* colors.txt in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Loading
Loading
Loading
Loading
@@ -51,5 +51,37 @@
</Locations>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "ColorPicker/CPKMainViewController.m"
timestampString = "466468610.039889"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "183"
endingLineNumber = "183"
landmarkName = "-colorPanelDidClose:"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "ColorPicker/CPKMainViewController.m"
timestampString = "466468610.039889"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "169"
endingLineNumber = "169"
landmarkName = "-setColorPanel:"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
Loading
Loading
@@ -23,10 +23,10 @@
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
Loading
Loading
@@ -38,15 +38,18 @@
ReferencedContainer = "container:ColorPicker.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
Loading
Loading
@@ -62,10 +65,10 @@
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
Loading
Loading
Loading
Loading
@@ -60,11 +60,11 @@
self.popover =
[CPKPopover presentRelativeToRect:presentationRect
ofView:presentingView
preferredEdge:CGRectMinYEdge
preferredEdge:NSRectEdgeMinY
initialColor:self.color
alphaAllowed:self.alphaAllowed
selectionDidChange:^(NSColor *color) {
self.selectedColor = color;
weakSelf.selectedColor = color;
if (weakSelf.delegate.isContinuous) {
weakSelf.color = color;
if (weakSelf.colorDidChange) {
Loading
Loading
@@ -78,6 +78,7 @@
if (weakSelf.willClosePopover) {
weakSelf.willClosePopover(weakSelf.color);
}
weakSelf.color = weakSelf.selectedColor;
weakSelf.open = NO;
weakSelf.popover = nil;
};
Loading
Loading
Loading
Loading
@@ -17,10 +17,16 @@
/** Block called when user clicks on the eyedropper. */
@property(nonatomic, copy) void (^startPickingBlock)();
 
/** Block called when user clicks the escape hatch. */
@property(nonatomic, copy) void (^toggleNativePickerBlock)(BOOL);
/** Reports this view's nominal height */
+ (CGFloat)desiredHeight;
 
/** Updates the swatch color. */
- (void)setSwatchColor:(NSColor *)color;
 
/** Call this when the color panel closes. */
- (void)colorPanelDidClose;
@end
Loading
Loading
@@ -13,6 +13,8 @@ static const CGFloat kBottomMargin = 8;
@property(nonatomic) NSButton *addFavorite;
@property(nonatomic) NSButton *removeFavorite;
@property(nonatomic) NSButton *eyedropperMode;
@property(nonatomic) NSButton *escapeHatch;
@property(nonatomic) BOOL useSystemColorPicker;
@property(nonatomic) CPKSwatchView *swatch;
@end
 
Loading
Loading
@@ -41,14 +43,21 @@ static const CGFloat kBottomMargin = 8;
[self.eyedropperMode setTarget:self];
[self.eyedropperMode setAction:@selector(eyedropperMode:)];
 
origin = NSMakePoint(NSMaxX(self.eyedropperMode.frame) + kMarginBetweenButtonsAndSwatch,
origin = NSMakePoint(NSMaxX(self.eyedropperMode.frame) + kMarginBetweenButtons,
kTopMargin);
self.escapeHatch = [self addButtonWithImage:[self cpk_imageNamed:@"EscapeHatch"]
origin:origin];
[self.escapeHatch setTarget:self];
[self.escapeHatch setAction:@selector(escapeHatch:)];
origin = NSMakePoint(NSMaxX(self.escapeHatch.frame) + kMarginBetweenButtonsAndSwatch,
kTopMargin);
self.swatch =
[[CPKSwatchView alloc] initWithFrame:NSMakeRect(NSMaxX(self.eyedropperMode.frame) +
[[CPKSwatchView alloc] initWithFrame:NSMakeRect(NSMaxX(self.escapeHatch.frame) +
kMarginBetweenButtonsAndSwatch,
kTopMargin,
NSWidth(frameRect) -
NSMaxX(self.eyedropperMode.frame) -
NSMaxX(self.escapeHatch.frame) -
kMarginBetweenButtonsAndSwatch -
kRightMargin,
NSHeight(self.addFavorite.frame))];
Loading
Loading
@@ -88,6 +97,17 @@ static const CGFloat kBottomMargin = 8;
return YES;
}
 
- (void)colorPanelDidClose {
self.useSystemColorPicker = NO;
}
- (void)setUseSystemColorPicker:(BOOL)useSystemColorPicker {
_useSystemColorPicker = useSystemColorPicker;
self.escapeHatch.image =
self.useSystemColorPicker ? [self cpk_imageNamed:@"ActiveEscapeHatch"] :
[self cpk_imageNamed:@"EscapeHatch"];
}
#pragma mark - Actions
 
- (void)addFavorite:(id)sender {
Loading
Loading
@@ -112,4 +132,11 @@ static const CGFloat kBottomMargin = 8;
}
}
 
- (void)escapeHatch:(id)sender {
if (_toggleNativePickerBlock) {
self.useSystemColorPicker = !self.useSystemColorPicker;
_toggleNativePickerBlock(self.useSystemColorPicker);
}
}
@end
Loading
Loading
@@ -22,6 +22,7 @@ static const CGFloat kBottomMargin = 8;
@property(nonatomic) CPKRGBView *rgbView;
@property(nonatomic) CPKControlsView *controlsView;
@property(nonatomic) CPKFavoritesView *favoritesView;
@property(nonatomic) NSColorPanel *colorPanel;
@property(nonatomic) BOOL alphaAllowed;
@end
 
Loading
Loading
@@ -100,7 +101,24 @@ static const CGFloat kBottomMargin = 8;
weakSelf.rgbView.selectedColor = color;
}
};
self.controlsView.toggleNativePickerBlock = ^(BOOL open) {
if (open) {
weakSelf.colorPanel = [NSColorPanel sharedColorPanel];
weakSelf.colorPanel.showsAlpha = weakSelf.alphaAllowed;
weakSelf.colorPanel.color = weakSelf.selectedColor;
[weakSelf.colorPanel setTarget:weakSelf];
[weakSelf.colorPanel setAction:@selector(colorPanelColorDidChange:)];
[weakSelf.colorPanel orderFront:nil];
NSRect frame = weakSelf.colorPanel.frame;
frame.origin = self.view.window.frame.origin;
[weakSelf.colorPanel setFrame:frame display:YES];
} else {
weakSelf.colorPanel = [NSColorPanel sharedColorPanel];
weakSelf.colorPanel.target = nil;
[weakSelf.colorPanel orderOut:nil];
weakSelf.colorPanel = nil;
}
};
self.favoritesView =
[[CPKFavoritesView alloc] initWithFrame:NSMakeRect(kLeftMargin,
NSMaxY(self.controlsView.frame),
Loading
Loading
@@ -133,4 +151,37 @@ static const CGFloat kBottomMargin = 8;
return kFavoritesHeight;
}
 
- (void)viewWillDisappear {
__weak NSColorPanel *colorPanel = self.colorPanel;
dispatch_async(dispatch_get_main_queue(), ^{
[colorPanel setTarget:nil];
[colorPanel orderOut:nil];
});
self.colorPanel = nil;
}
- (void)colorPanelColorDidChange:(id)sender {
NSColorPanel *colorPanel = [NSColorPanel sharedColorPanel];
self.rgbView.selectedColor = [colorPanel color];
}
- (void)setColorPanel:(NSColorPanel *)colorPanel {
if (colorPanel) {
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(colorPanelDidClose:)
name:NSWindowWillCloseNotification
object:_colorPanel];
} else {
[[NSNotificationCenter defaultCenter] removeObserver:self
name:NSWindowWillCloseNotification
object:_colorPanel];
}
_colorPanel = colorPanel;
}
- (void)colorPanelDidClose:(NSNotification *)notification {
[self.controlsView colorPanelDidClose];
self.colorPanel = nil;
}
@end
Loading
Loading
@@ -255,7 +255,7 @@ static const CGFloat kMarginBetweenSliders = 8;
 
#pragma mark - NSControlTextEditingDelegate
 
- (void)controlTextDidEndEditing:(NSNotification *)obj {
- (void)controlTextDidChange:(NSNotification *)obj {
NSTextField *textField = [obj object];
NSScanner *scanner = [NSScanner scannerWithString:textField.stringValue];
int i;
Loading
Loading
@@ -264,8 +264,6 @@ static const CGFloat kMarginBetweenSliders = 8;
NSColor *color = [self colorWithHexString:self.hexTextField.stringValue];
if (color) {
self.selectedColor = color;
} else {
self.selectedColor = _selectedColor;
}
} else if (textField == self.redTextField) {
if (isInteger) {
Loading
Loading
@@ -273,8 +271,6 @@ static const CGFloat kMarginBetweenSliders = 8;
green:_selectedColor.greenComponent
blue:_selectedColor.blueComponent
alpha:_selectedColor.alphaComponent];
} else {
self.selectedColor = _selectedColor;
}
} else if (textField == self.greenTextField) {
if (isInteger) {
Loading
Loading
@@ -282,8 +278,6 @@ static const CGFloat kMarginBetweenSliders = 8;
green:i / 255.0
blue:_selectedColor.blueComponent
alpha:_selectedColor.alphaComponent];
} else {
self.selectedColor = _selectedColor;
}
} else if (textField == self.blueTextField) {
if (isInteger) {
Loading
Loading
@@ -291,8 +285,6 @@ static const CGFloat kMarginBetweenSliders = 8;
green:_selectedColor.greenComponent
blue:i / 255.0
alpha:_selectedColor.alphaComponent];
} else {
self.selectedColor = _selectedColor;
}
} else if (self.alphaAllowed && textField == self.alphaTextField) {
if (isInteger) {
Loading
Loading
@@ -300,8 +292,6 @@ static const CGFloat kMarginBetweenSliders = 8;
green:_selectedColor.greenComponent
blue:_selectedColor.blueComponent
alpha:i / 255.0];
} else {
self.selectedColor = _selectedColor;
}
}
}
Loading
Loading
@@ -315,14 +305,7 @@ static const CGFloat kMarginBetweenSliders = 8;
int r;
int g;
int b;
if (hexString.length == 3) {
r = (value >> 8) & 0x0f;
r |= r << 4;
g = (value >> 4) & 0x0f;
g |= g << 4;
b = (value >> 0) & 0x0f;
b |= b << 4;
} else if (hexString.length == 6) {
if (hexString.length == 6) {
r = (value >> 16) & 0xff;
g = (value >> 8) & 0xff;
b = (value >> 0) & 0xff;
Loading
Loading
ColorPicker/ColorPicker/Images.xcassets/ActiveEscapeHatch/ActiveEscapeHatch.png

455 B

ColorPicker/ColorPicker/Images.xcassets/ActiveEscapeHatch/ActiveEscapeHatch@2x.png

835 B

No preview for this file type
ColorPicker/ColorPicker/Images.xcassets/EscapeHatch/EscapeHatch.png

468 B

ColorPicker/ColorPicker/Images.xcassets/EscapeHatch/EscapeHatch@2x.png

818 B

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="7531" systemVersion="14F27" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="8191" systemVersion="14F27" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="7531"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="8191"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
Loading
Loading
@@ -673,10 +673,10 @@
<window title="ColorPickerDemo" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="335" y="390" width="397" height="355"/>
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="877"/>
<rect key="contentRect" x="335" y="390" width="470" height="355"/>
<rect key="screenRect" x="0.0" y="0.0" width="1920" height="1057"/>
<view key="contentView" id="EiT-Mj-1SZ">
<rect key="frame" x="0.0" y="-1" width="397" height="355"/>
<rect key="frame" x="0.0" y="0.0" width="470" height="355"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="MuN-WJ-BSh" customClass="CPKColorWell">
Loading
Loading
@@ -701,9 +701,15 @@
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="vGh-Vt-M6V" customClass="CPKColorWell">
<rect key="frame" x="397" y="313" width="53" height="27"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="alphaAllowed" value="YES"/>
</userDefinedRuntimeAttributes>
</customView>
</subviews>
</view>
<point key="canvasLocation" x="274.5" y="331.5"/>
<point key="canvasLocation" x="311" y="331.5"/>
</window>
</objects>
</document>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment