├── Hues.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcshareddata │ └── xcschemes │ └── Hues.xcscheme ├── README.md ├── resources └── Images.xcassets │ └── AppIcon.appiconset │ ├── Contents.json │ ├── icon_128.png │ ├── icon_128@2x.png │ ├── icon_16x16.png │ ├── icon_16x16@2x.png │ ├── icon_256.png │ ├── icon_256@2x.png │ ├── icon_32x32.png │ ├── icon_32x32@2x.png │ ├── icon_512.png │ └── icon_512@2x.png ├── source ├── Hues-Info.plist ├── Hues-Prefix.pch ├── HuesAppDelegate.h ├── HuesAppDelegate.m ├── HuesColorsView.h ├── HuesColorsView.m ├── HuesColorsView.xib ├── HuesGlobal.h ├── HuesGlobal.m ├── HuesHistoryManager.h ├── HuesHistoryManager.m ├── HuesPreferences.h ├── HuesPreferences.m ├── HuesPreferences.xib ├── HuesPreferencesController.h ├── HuesPreferencesController.m ├── HuesWindowController.h ├── HuesWindowController.m ├── MainMenu.xib ├── NSColor+Extras.h ├── NSColor+Extras.m ├── NSImage+Hues.h ├── NSImage+Hues.m ├── en.lproj │ └── InfoPlist.strings └── main.m └── tests ├── HuesColorTest.m ├── HuesTests-Info.plist ├── HuesTests-Prefix.pch └── en.lproj └── InfoPlist.strings /Hues.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 9264FE621393EC9F00935FAC /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9264FE611393EC9F00935FAC /* Cocoa.framework */; }; 11 | 9264FE6C1393EC9F00935FAC /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 9264FE6A1393EC9F00935FAC /* InfoPlist.strings */; }; 12 | 9264FE6F1393EC9F00935FAC /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 9264FE6E1393EC9F00935FAC /* main.m */; }; 13 | 9264FE7F1393ECA000935FAC /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9264FE611393EC9F00935FAC /* Cocoa.framework */; }; 14 | 9264FE871393ECA000935FAC /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 9264FE851393ECA000935FAC /* InfoPlist.strings */; }; 15 | 92D7267A1A5B85FB00314A12 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 92D726791A5B85FB00314A12 /* Images.xcassets */; }; 16 | 92E7D68A1393ED080072C412 /* HuesAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 92E7D6791393ED080072C412 /* HuesAppDelegate.m */; }; 17 | 92E7D68B1393ED080072C412 /* HuesColorsView.m in Sources */ = {isa = PBXBuildFile; fileRef = 92E7D67B1393ED080072C412 /* HuesColorsView.m */; }; 18 | 92E7D68C1393ED080072C412 /* HuesGlobal.m in Sources */ = {isa = PBXBuildFile; fileRef = 92E7D67D1393ED080072C412 /* HuesGlobal.m */; }; 19 | 92E7D68D1393ED080072C412 /* HuesHistoryManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 92E7D67F1393ED080072C412 /* HuesHistoryManager.m */; }; 20 | 92E7D68E1393ED080072C412 /* HuesWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 92E7D6811393ED080072C412 /* HuesWindowController.m */; }; 21 | 92E7D68F1393ED080072C412 /* HuesPreferences.m in Sources */ = {isa = PBXBuildFile; fileRef = 92E7D6831393ED080072C412 /* HuesPreferences.m */; }; 22 | 92E7D6901393ED080072C412 /* HuesPreferencesController.m in Sources */ = {isa = PBXBuildFile; fileRef = 92E7D6851393ED080072C412 /* HuesPreferencesController.m */; }; 23 | 92E7D6911393ED080072C412 /* NSColor+Extras.m in Sources */ = {isa = PBXBuildFile; fileRef = 92E7D6871393ED080072C412 /* NSColor+Extras.m */; }; 24 | 92E7D6921393ED080072C412 /* NSImage+Hues.m in Sources */ = {isa = PBXBuildFile; fileRef = 92E7D6891393ED080072C412 /* NSImage+Hues.m */; }; 25 | 92E7D69D1393ED830072C412 /* HuesColorsView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 92E7D69B1393ED830072C412 /* HuesColorsView.xib */; }; 26 | 92E7D69E1393ED830072C412 /* HuesPreferences.xib in Resources */ = {isa = PBXBuildFile; fileRef = 92E7D69C1393ED830072C412 /* HuesPreferences.xib */; }; 27 | 92E7D6A91393EDFA0072C412 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 92E7D6A81393EDFA0072C412 /* MainMenu.xib */; }; 28 | 92E7D6B81393F1E70072C412 /* HuesColorTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 92E7D6B71393F1E70072C412 /* HuesColorTest.m */; }; 29 | /* End PBXBuildFile section */ 30 | 31 | /* Begin PBXContainerItemProxy section */ 32 | 9264FE801393ECA000935FAC /* PBXContainerItemProxy */ = { 33 | isa = PBXContainerItemProxy; 34 | containerPortal = 9264FE541393EC9F00935FAC /* Project object */; 35 | proxyType = 1; 36 | remoteGlobalIDString = 9264FE5C1393EC9F00935FAC; 37 | remoteInfo = Hues; 38 | }; 39 | /* End PBXContainerItemProxy section */ 40 | 41 | /* Begin PBXFileReference section */ 42 | 9264FE5D1393EC9F00935FAC /* Hues.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Hues.app; sourceTree = BUILT_PRODUCTS_DIR; }; 43 | 9264FE611393EC9F00935FAC /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; 44 | 9264FE641393EC9F00935FAC /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; 45 | 9264FE651393EC9F00935FAC /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; }; 46 | 9264FE661393EC9F00935FAC /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 47 | 9264FE691393EC9F00935FAC /* Hues-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Hues-Info.plist"; sourceTree = ""; }; 48 | 9264FE6B1393EC9F00935FAC /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 49 | 9264FE6D1393EC9F00935FAC /* Hues-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Hues-Prefix.pch"; sourceTree = ""; }; 50 | 9264FE6E1393EC9F00935FAC /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 51 | 9264FE7E1393ECA000935FAC /* HuesTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = HuesTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | 9264FE841393ECA000935FAC /* HuesTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "HuesTests-Info.plist"; sourceTree = ""; }; 53 | 9264FE861393ECA000935FAC /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 54 | 9264FE881393ECA000935FAC /* HuesTests-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "HuesTests-Prefix.pch"; sourceTree = ""; }; 55 | 92D726791A5B85FB00314A12 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = resources/Images.xcassets; sourceTree = SOURCE_ROOT; }; 56 | 92E7D6781393ED080072C412 /* HuesAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HuesAppDelegate.h; sourceTree = ""; }; 57 | 92E7D6791393ED080072C412 /* HuesAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HuesAppDelegate.m; sourceTree = ""; }; 58 | 92E7D67A1393ED080072C412 /* HuesColorsView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HuesColorsView.h; sourceTree = ""; }; 59 | 92E7D67B1393ED080072C412 /* HuesColorsView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HuesColorsView.m; sourceTree = ""; }; 60 | 92E7D67C1393ED080072C412 /* HuesGlobal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HuesGlobal.h; sourceTree = ""; }; 61 | 92E7D67D1393ED080072C412 /* HuesGlobal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HuesGlobal.m; sourceTree = ""; }; 62 | 92E7D67E1393ED080072C412 /* HuesHistoryManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HuesHistoryManager.h; sourceTree = ""; }; 63 | 92E7D67F1393ED080072C412 /* HuesHistoryManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HuesHistoryManager.m; sourceTree = ""; }; 64 | 92E7D6801393ED080072C412 /* HuesWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HuesWindowController.h; sourceTree = ""; }; 65 | 92E7D6811393ED080072C412 /* HuesWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HuesWindowController.m; sourceTree = ""; }; 66 | 92E7D6821393ED080072C412 /* HuesPreferences.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HuesPreferences.h; sourceTree = ""; }; 67 | 92E7D6831393ED080072C412 /* HuesPreferences.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HuesPreferences.m; sourceTree = ""; }; 68 | 92E7D6841393ED080072C412 /* HuesPreferencesController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HuesPreferencesController.h; sourceTree = ""; }; 69 | 92E7D6851393ED080072C412 /* HuesPreferencesController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HuesPreferencesController.m; sourceTree = ""; }; 70 | 92E7D6861393ED080072C412 /* NSColor+Extras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSColor+Extras.h"; sourceTree = ""; }; 71 | 92E7D6871393ED080072C412 /* NSColor+Extras.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSColor+Extras.m"; sourceTree = ""; }; 72 | 92E7D6881393ED080072C412 /* NSImage+Hues.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSImage+Hues.h"; sourceTree = ""; }; 73 | 92E7D6891393ED080072C412 /* NSImage+Hues.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSImage+Hues.m"; sourceTree = ""; }; 74 | 92E7D69B1393ED830072C412 /* HuesColorsView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = HuesColorsView.xib; sourceTree = ""; }; 75 | 92E7D69C1393ED830072C412 /* HuesPreferences.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = HuesPreferences.xib; sourceTree = ""; }; 76 | 92E7D6A81393EDFA0072C412 /* MainMenu.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MainMenu.xib; sourceTree = ""; }; 77 | 92E7D6B71393F1E70072C412 /* HuesColorTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HuesColorTest.m; sourceTree = ""; }; 78 | /* End PBXFileReference section */ 79 | 80 | /* Begin PBXFrameworksBuildPhase section */ 81 | 9264FE5A1393EC9F00935FAC /* Frameworks */ = { 82 | isa = PBXFrameworksBuildPhase; 83 | buildActionMask = 2147483647; 84 | files = ( 85 | 9264FE621393EC9F00935FAC /* Cocoa.framework in Frameworks */, 86 | ); 87 | runOnlyForDeploymentPostprocessing = 0; 88 | }; 89 | 9264FE7A1393ECA000935FAC /* Frameworks */ = { 90 | isa = PBXFrameworksBuildPhase; 91 | buildActionMask = 2147483647; 92 | files = ( 93 | 9264FE7F1393ECA000935FAC /* Cocoa.framework in Frameworks */, 94 | ); 95 | runOnlyForDeploymentPostprocessing = 0; 96 | }; 97 | /* End PBXFrameworksBuildPhase section */ 98 | 99 | /* Begin PBXGroup section */ 100 | 9264FE521393EC9F00935FAC = { 101 | isa = PBXGroup; 102 | children = ( 103 | 9264FE671393EC9F00935FAC /* Hues */, 104 | 9264FE821393ECA000935FAC /* Tests */, 105 | 9264FE601393EC9F00935FAC /* Frameworks */, 106 | 9264FE5E1393EC9F00935FAC /* Products */, 107 | ); 108 | sourceTree = ""; 109 | }; 110 | 9264FE5E1393EC9F00935FAC /* Products */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | 9264FE5D1393EC9F00935FAC /* Hues.app */, 114 | 9264FE7E1393ECA000935FAC /* HuesTests.xctest */, 115 | ); 116 | name = Products; 117 | sourceTree = ""; 118 | }; 119 | 9264FE601393EC9F00935FAC /* Frameworks */ = { 120 | isa = PBXGroup; 121 | children = ( 122 | 9264FE611393EC9F00935FAC /* Cocoa.framework */, 123 | 9264FE631393EC9F00935FAC /* Other Frameworks */, 124 | ); 125 | name = Frameworks; 126 | sourceTree = ""; 127 | }; 128 | 9264FE631393EC9F00935FAC /* Other Frameworks */ = { 129 | isa = PBXGroup; 130 | children = ( 131 | 9264FE641393EC9F00935FAC /* AppKit.framework */, 132 | 9264FE651393EC9F00935FAC /* CoreData.framework */, 133 | 9264FE661393EC9F00935FAC /* Foundation.framework */, 134 | ); 135 | name = "Other Frameworks"; 136 | sourceTree = ""; 137 | }; 138 | 9264FE671393EC9F00935FAC /* Hues */ = { 139 | isa = PBXGroup; 140 | children = ( 141 | 92E7D6B21393EFB70072C412 /* Categories */, 142 | 92E7D6B51393EFEE0072C412 /* Models */, 143 | 92E7D6B41393EFDC0072C412 /* Views */, 144 | 92E7D6B31393EFC60072C412 /* Controllers */, 145 | 92E7D6751393ECD10072C412 /* Interface */, 146 | 92E7D6771393ECDA0072C412 /* Resources */, 147 | 9264FE681393EC9F00935FAC /* Supporting Files */, 148 | ); 149 | name = Hues; 150 | path = source; 151 | sourceTree = ""; 152 | }; 153 | 9264FE681393EC9F00935FAC /* Supporting Files */ = { 154 | isa = PBXGroup; 155 | children = ( 156 | 9264FE691393EC9F00935FAC /* Hues-Info.plist */, 157 | 9264FE6A1393EC9F00935FAC /* InfoPlist.strings */, 158 | 9264FE6D1393EC9F00935FAC /* Hues-Prefix.pch */, 159 | 9264FE6E1393EC9F00935FAC /* main.m */, 160 | ); 161 | name = "Supporting Files"; 162 | sourceTree = ""; 163 | }; 164 | 9264FE821393ECA000935FAC /* Tests */ = { 165 | isa = PBXGroup; 166 | children = ( 167 | 9264FE831393ECA000935FAC /* Supporting Files */, 168 | 92E7D6B71393F1E70072C412 /* HuesColorTest.m */, 169 | ); 170 | name = Tests; 171 | path = tests; 172 | sourceTree = ""; 173 | }; 174 | 9264FE831393ECA000935FAC /* Supporting Files */ = { 175 | isa = PBXGroup; 176 | children = ( 177 | 9264FE841393ECA000935FAC /* HuesTests-Info.plist */, 178 | 9264FE851393ECA000935FAC /* InfoPlist.strings */, 179 | 9264FE881393ECA000935FAC /* HuesTests-Prefix.pch */, 180 | ); 181 | name = "Supporting Files"; 182 | sourceTree = ""; 183 | }; 184 | 92E7D6751393ECD10072C412 /* Interface */ = { 185 | isa = PBXGroup; 186 | children = ( 187 | 92E7D6A81393EDFA0072C412 /* MainMenu.xib */, 188 | 92E7D69B1393ED830072C412 /* HuesColorsView.xib */, 189 | 92E7D69C1393ED830072C412 /* HuesPreferences.xib */, 190 | ); 191 | name = Interface; 192 | sourceTree = ""; 193 | }; 194 | 92E7D6771393ECDA0072C412 /* Resources */ = { 195 | isa = PBXGroup; 196 | children = ( 197 | 92D726791A5B85FB00314A12 /* Images.xcassets */, 198 | ); 199 | name = Resources; 200 | path = ../resources; 201 | sourceTree = ""; 202 | }; 203 | 92E7D6B21393EFB70072C412 /* Categories */ = { 204 | isa = PBXGroup; 205 | children = ( 206 | 92E7D6861393ED080072C412 /* NSColor+Extras.h */, 207 | 92E7D6871393ED080072C412 /* NSColor+Extras.m */, 208 | 92E7D6881393ED080072C412 /* NSImage+Hues.h */, 209 | 92E7D6891393ED080072C412 /* NSImage+Hues.m */, 210 | ); 211 | name = Categories; 212 | sourceTree = ""; 213 | }; 214 | 92E7D6B31393EFC60072C412 /* Controllers */ = { 215 | isa = PBXGroup; 216 | children = ( 217 | 92E7D6781393ED080072C412 /* HuesAppDelegate.h */, 218 | 92E7D6791393ED080072C412 /* HuesAppDelegate.m */, 219 | 92E7D6801393ED080072C412 /* HuesWindowController.h */, 220 | 92E7D6811393ED080072C412 /* HuesWindowController.m */, 221 | 92E7D6841393ED080072C412 /* HuesPreferencesController.h */, 222 | 92E7D6851393ED080072C412 /* HuesPreferencesController.m */, 223 | ); 224 | name = Controllers; 225 | sourceTree = ""; 226 | }; 227 | 92E7D6B41393EFDC0072C412 /* Views */ = { 228 | isa = PBXGroup; 229 | children = ( 230 | 92E7D67A1393ED080072C412 /* HuesColorsView.h */, 231 | 92E7D67B1393ED080072C412 /* HuesColorsView.m */, 232 | ); 233 | name = Views; 234 | sourceTree = ""; 235 | }; 236 | 92E7D6B51393EFEE0072C412 /* Models */ = { 237 | isa = PBXGroup; 238 | children = ( 239 | 92E7D67C1393ED080072C412 /* HuesGlobal.h */, 240 | 92E7D67D1393ED080072C412 /* HuesGlobal.m */, 241 | 92E7D67E1393ED080072C412 /* HuesHistoryManager.h */, 242 | 92E7D67F1393ED080072C412 /* HuesHistoryManager.m */, 243 | 92E7D6821393ED080072C412 /* HuesPreferences.h */, 244 | 92E7D6831393ED080072C412 /* HuesPreferences.m */, 245 | ); 246 | name = Models; 247 | sourceTree = ""; 248 | }; 249 | /* End PBXGroup section */ 250 | 251 | /* Begin PBXNativeTarget section */ 252 | 9264FE5C1393EC9F00935FAC /* Hues */ = { 253 | isa = PBXNativeTarget; 254 | buildConfigurationList = 9264FE8F1393ECA000935FAC /* Build configuration list for PBXNativeTarget "Hues" */; 255 | buildPhases = ( 256 | 9264FE591393EC9F00935FAC /* Sources */, 257 | 9264FE5A1393EC9F00935FAC /* Frameworks */, 258 | 9264FE5B1393EC9F00935FAC /* Resources */, 259 | ); 260 | buildRules = ( 261 | ); 262 | dependencies = ( 263 | ); 264 | name = Hues; 265 | productName = Hues; 266 | productReference = 9264FE5D1393EC9F00935FAC /* Hues.app */; 267 | productType = "com.apple.product-type.application"; 268 | }; 269 | 9264FE7D1393ECA000935FAC /* HuesTests */ = { 270 | isa = PBXNativeTarget; 271 | buildConfigurationList = 9264FE921393ECA000935FAC /* Build configuration list for PBXNativeTarget "HuesTests" */; 272 | buildPhases = ( 273 | 9264FE791393ECA000935FAC /* Sources */, 274 | 9264FE7A1393ECA000935FAC /* Frameworks */, 275 | 9264FE7B1393ECA000935FAC /* Resources */, 276 | 92751ED9139BF0A30029B659 /* Remove Preferences */, 277 | 9264FE7C1393ECA000935FAC /* ShellScript */, 278 | ); 279 | buildRules = ( 280 | ); 281 | dependencies = ( 282 | 9264FE811393ECA000935FAC /* PBXTargetDependency */, 283 | ); 284 | name = HuesTests; 285 | productName = HuesTests; 286 | productReference = 9264FE7E1393ECA000935FAC /* HuesTests.xctest */; 287 | productType = "com.apple.product-type.bundle.unit-test"; 288 | }; 289 | /* End PBXNativeTarget section */ 290 | 291 | /* Begin PBXProject section */ 292 | 9264FE541393EC9F00935FAC /* Project object */ = { 293 | isa = PBXProject; 294 | attributes = { 295 | LastUpgradeCheck = 1010; 296 | ORGANIZATIONNAME = "Giant Comet"; 297 | }; 298 | buildConfigurationList = 9264FE571393EC9F00935FAC /* Build configuration list for PBXProject "Hues" */; 299 | compatibilityVersion = "Xcode 3.2"; 300 | developmentRegion = English; 301 | hasScannedForEncodings = 0; 302 | knownRegions = ( 303 | en, 304 | English, 305 | ); 306 | mainGroup = 9264FE521393EC9F00935FAC; 307 | productRefGroup = 9264FE5E1393EC9F00935FAC /* Products */; 308 | projectDirPath = ""; 309 | projectRoot = ""; 310 | targets = ( 311 | 9264FE5C1393EC9F00935FAC /* Hues */, 312 | 9264FE7D1393ECA000935FAC /* HuesTests */, 313 | ); 314 | }; 315 | /* End PBXProject section */ 316 | 317 | /* Begin PBXResourcesBuildPhase section */ 318 | 9264FE5B1393EC9F00935FAC /* Resources */ = { 319 | isa = PBXResourcesBuildPhase; 320 | buildActionMask = 2147483647; 321 | files = ( 322 | 9264FE6C1393EC9F00935FAC /* InfoPlist.strings in Resources */, 323 | 92D7267A1A5B85FB00314A12 /* Images.xcassets in Resources */, 324 | 92E7D69D1393ED830072C412 /* HuesColorsView.xib in Resources */, 325 | 92E7D69E1393ED830072C412 /* HuesPreferences.xib in Resources */, 326 | 92E7D6A91393EDFA0072C412 /* MainMenu.xib in Resources */, 327 | ); 328 | runOnlyForDeploymentPostprocessing = 0; 329 | }; 330 | 9264FE7B1393ECA000935FAC /* Resources */ = { 331 | isa = PBXResourcesBuildPhase; 332 | buildActionMask = 2147483647; 333 | files = ( 334 | 9264FE871393ECA000935FAC /* InfoPlist.strings in Resources */, 335 | ); 336 | runOnlyForDeploymentPostprocessing = 0; 337 | }; 338 | /* End PBXResourcesBuildPhase section */ 339 | 340 | /* Begin PBXShellScriptBuildPhase section */ 341 | 9264FE7C1393ECA000935FAC /* ShellScript */ = { 342 | isa = PBXShellScriptBuildPhase; 343 | buildActionMask = 2147483647; 344 | files = ( 345 | ); 346 | inputPaths = ( 347 | ); 348 | outputPaths = ( 349 | ); 350 | runOnlyForDeploymentPostprocessing = 0; 351 | shellPath = /bin/sh; 352 | shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n"; 353 | }; 354 | 92751ED9139BF0A30029B659 /* Remove Preferences */ = { 355 | isa = PBXShellScriptBuildPhase; 356 | buildActionMask = 2147483647; 357 | files = ( 358 | ); 359 | inputPaths = ( 360 | ); 361 | name = "Remove Preferences"; 362 | outputPaths = ( 363 | ); 364 | runOnlyForDeploymentPostprocessing = 0; 365 | shellPath = /usr/bin/ruby; 366 | shellScript = "require 'FileUtils'\n\nfile = \"/Users/zach/Library/Preferences/com.giantcomet.hues.plist\"\n\nif File.exists? file\n FileUtils.rm(file)\nend"; 367 | }; 368 | /* End PBXShellScriptBuildPhase section */ 369 | 370 | /* Begin PBXSourcesBuildPhase section */ 371 | 9264FE591393EC9F00935FAC /* Sources */ = { 372 | isa = PBXSourcesBuildPhase; 373 | buildActionMask = 2147483647; 374 | files = ( 375 | 9264FE6F1393EC9F00935FAC /* main.m in Sources */, 376 | 92E7D68A1393ED080072C412 /* HuesAppDelegate.m in Sources */, 377 | 92E7D68B1393ED080072C412 /* HuesColorsView.m in Sources */, 378 | 92E7D68C1393ED080072C412 /* HuesGlobal.m in Sources */, 379 | 92E7D68D1393ED080072C412 /* HuesHistoryManager.m in Sources */, 380 | 92E7D68E1393ED080072C412 /* HuesWindowController.m in Sources */, 381 | 92E7D68F1393ED080072C412 /* HuesPreferences.m in Sources */, 382 | 92E7D6901393ED080072C412 /* HuesPreferencesController.m in Sources */, 383 | 92E7D6911393ED080072C412 /* NSColor+Extras.m in Sources */, 384 | 92E7D6921393ED080072C412 /* NSImage+Hues.m in Sources */, 385 | ); 386 | runOnlyForDeploymentPostprocessing = 0; 387 | }; 388 | 9264FE791393ECA000935FAC /* Sources */ = { 389 | isa = PBXSourcesBuildPhase; 390 | buildActionMask = 2147483647; 391 | files = ( 392 | 92E7D6B81393F1E70072C412 /* HuesColorTest.m in Sources */, 393 | ); 394 | runOnlyForDeploymentPostprocessing = 0; 395 | }; 396 | /* End PBXSourcesBuildPhase section */ 397 | 398 | /* Begin PBXTargetDependency section */ 399 | 9264FE811393ECA000935FAC /* PBXTargetDependency */ = { 400 | isa = PBXTargetDependency; 401 | target = 9264FE5C1393EC9F00935FAC /* Hues */; 402 | targetProxy = 9264FE801393ECA000935FAC /* PBXContainerItemProxy */; 403 | }; 404 | /* End PBXTargetDependency section */ 405 | 406 | /* Begin PBXVariantGroup section */ 407 | 9264FE6A1393EC9F00935FAC /* InfoPlist.strings */ = { 408 | isa = PBXVariantGroup; 409 | children = ( 410 | 9264FE6B1393EC9F00935FAC /* en */, 411 | ); 412 | name = InfoPlist.strings; 413 | sourceTree = ""; 414 | }; 415 | 9264FE851393ECA000935FAC /* InfoPlist.strings */ = { 416 | isa = PBXVariantGroup; 417 | children = ( 418 | 9264FE861393ECA000935FAC /* en */, 419 | ); 420 | name = InfoPlist.strings; 421 | sourceTree = ""; 422 | }; 423 | /* End PBXVariantGroup section */ 424 | 425 | /* Begin XCBuildConfiguration section */ 426 | 9264FE8D1393ECA000935FAC /* Debug */ = { 427 | isa = XCBuildConfiguration; 428 | buildSettings = { 429 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 430 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 431 | CLANG_WARN_BOOL_CONVERSION = YES; 432 | CLANG_WARN_COMMA = YES; 433 | CLANG_WARN_CONSTANT_CONVERSION = YES; 434 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 435 | CLANG_WARN_EMPTY_BODY = YES; 436 | CLANG_WARN_ENUM_CONVERSION = YES; 437 | CLANG_WARN_INFINITE_RECURSION = YES; 438 | CLANG_WARN_INT_CONVERSION = YES; 439 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 440 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 441 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 442 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 443 | CLANG_WARN_STRICT_PROTOTYPES = YES; 444 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 445 | CLANG_WARN_UNREACHABLE_CODE = YES; 446 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 447 | ENABLE_STRICT_OBJC_MSGSEND = YES; 448 | ENABLE_TESTABILITY = YES; 449 | GCC_C_LANGUAGE_STANDARD = gnu99; 450 | GCC_NO_COMMON_BLOCKS = YES; 451 | GCC_OPTIMIZATION_LEVEL = 0; 452 | GCC_PREPROCESSOR_DEFINITIONS = DEBUG; 453 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 454 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 455 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 456 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 457 | GCC_WARN_UNDECLARED_SELECTOR = YES; 458 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 459 | GCC_WARN_UNUSED_FUNCTION = YES; 460 | GCC_WARN_UNUSED_VARIABLE = YES; 461 | MACOSX_DEPLOYMENT_TARGET = 10.10; 462 | ONLY_ACTIVE_ARCH = YES; 463 | SDKROOT = macosx; 464 | }; 465 | name = Debug; 466 | }; 467 | 9264FE8E1393ECA000935FAC /* Release */ = { 468 | isa = XCBuildConfiguration; 469 | buildSettings = { 470 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 471 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 472 | CLANG_WARN_BOOL_CONVERSION = YES; 473 | CLANG_WARN_COMMA = YES; 474 | CLANG_WARN_CONSTANT_CONVERSION = YES; 475 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 476 | CLANG_WARN_EMPTY_BODY = YES; 477 | CLANG_WARN_ENUM_CONVERSION = YES; 478 | CLANG_WARN_INFINITE_RECURSION = YES; 479 | CLANG_WARN_INT_CONVERSION = YES; 480 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 481 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 482 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 483 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 484 | CLANG_WARN_STRICT_PROTOTYPES = YES; 485 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 486 | CLANG_WARN_UNREACHABLE_CODE = YES; 487 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 488 | ENABLE_STRICT_OBJC_MSGSEND = YES; 489 | GCC_C_LANGUAGE_STANDARD = gnu99; 490 | GCC_NO_COMMON_BLOCKS = YES; 491 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 492 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 493 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 494 | GCC_WARN_UNDECLARED_SELECTOR = YES; 495 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 496 | GCC_WARN_UNUSED_FUNCTION = YES; 497 | GCC_WARN_UNUSED_VARIABLE = YES; 498 | MACOSX_DEPLOYMENT_TARGET = 10.10; 499 | SDKROOT = macosx; 500 | }; 501 | name = Release; 502 | }; 503 | 9264FE901393ECA000935FAC /* Debug */ = { 504 | isa = XCBuildConfiguration; 505 | buildSettings = { 506 | ALWAYS_SEARCH_USER_PATHS = NO; 507 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 508 | CLANG_ENABLE_OBJC_ARC = YES; 509 | COMBINE_HIDPI_IMAGES = YES; 510 | COPY_PHASE_STRIP = NO; 511 | GCC_DYNAMIC_NO_PIC = NO; 512 | GCC_ENABLE_OBJC_EXCEPTIONS = YES; 513 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 514 | GCC_PREFIX_HEADER = "source/Hues-Prefix.pch"; 515 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 516 | INFOPLIST_FILE = "source/Hues-Info.plist"; 517 | PRODUCT_BUNDLE_IDENTIFIER = me.zachwaugh.hues; 518 | PRODUCT_NAME = "$(TARGET_NAME)"; 519 | WRAPPER_EXTENSION = app; 520 | }; 521 | name = Debug; 522 | }; 523 | 9264FE911393ECA000935FAC /* Release */ = { 524 | isa = XCBuildConfiguration; 525 | buildSettings = { 526 | ALWAYS_SEARCH_USER_PATHS = NO; 527 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 528 | CLANG_ENABLE_OBJC_ARC = YES; 529 | COMBINE_HIDPI_IMAGES = YES; 530 | COPY_PHASE_STRIP = YES; 531 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 532 | GCC_ENABLE_OBJC_EXCEPTIONS = YES; 533 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 534 | GCC_PREFIX_HEADER = "source/Hues-Prefix.pch"; 535 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 536 | INFOPLIST_FILE = "source/Hues-Info.plist"; 537 | PRODUCT_BUNDLE_IDENTIFIER = me.zachwaugh.hues; 538 | PRODUCT_NAME = "$(TARGET_NAME)"; 539 | WRAPPER_EXTENSION = app; 540 | }; 541 | name = Release; 542 | }; 543 | 9264FE931393ECA000935FAC /* Debug */ = { 544 | isa = XCBuildConfiguration; 545 | buildSettings = { 546 | ALWAYS_SEARCH_USER_PATHS = NO; 547 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/Hues.app/Contents/MacOS/Hues"; 548 | CLANG_ENABLE_OBJC_WEAK = YES; 549 | COMBINE_HIDPI_IMAGES = YES; 550 | COPY_PHASE_STRIP = NO; 551 | FRAMEWORK_SEARCH_PATHS = "$(inherited)"; 552 | GCC_DYNAMIC_NO_PIC = NO; 553 | GCC_ENABLE_OBJC_EXCEPTIONS = YES; 554 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 555 | GCC_PREFIX_HEADER = "tests/HuesTests-Prefix.pch"; 556 | INFOPLIST_FILE = "tests/HuesTests-Info.plist"; 557 | PRODUCT_BUNDLE_IDENTIFIER = "com.giantcomet.${PRODUCT_NAME:rfc1034identifier}"; 558 | PRODUCT_NAME = "$(TARGET_NAME)"; 559 | TEST_HOST = "$(BUNDLE_LOADER)"; 560 | }; 561 | name = Debug; 562 | }; 563 | 9264FE941393ECA000935FAC /* Release */ = { 564 | isa = XCBuildConfiguration; 565 | buildSettings = { 566 | ALWAYS_SEARCH_USER_PATHS = NO; 567 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/Hues.app/Contents/MacOS/Hues"; 568 | CLANG_ENABLE_OBJC_WEAK = YES; 569 | COMBINE_HIDPI_IMAGES = YES; 570 | COPY_PHASE_STRIP = YES; 571 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 572 | FRAMEWORK_SEARCH_PATHS = "$(inherited)"; 573 | GCC_ENABLE_OBJC_EXCEPTIONS = YES; 574 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 575 | GCC_PREFIX_HEADER = "tests/HuesTests-Prefix.pch"; 576 | INFOPLIST_FILE = "tests/HuesTests-Info.plist"; 577 | PRODUCT_BUNDLE_IDENTIFIER = "com.giantcomet.${PRODUCT_NAME:rfc1034identifier}"; 578 | PRODUCT_NAME = "$(TARGET_NAME)"; 579 | TEST_HOST = "$(BUNDLE_LOADER)"; 580 | }; 581 | name = Release; 582 | }; 583 | /* End XCBuildConfiguration section */ 584 | 585 | /* Begin XCConfigurationList section */ 586 | 9264FE571393EC9F00935FAC /* Build configuration list for PBXProject "Hues" */ = { 587 | isa = XCConfigurationList; 588 | buildConfigurations = ( 589 | 9264FE8D1393ECA000935FAC /* Debug */, 590 | 9264FE8E1393ECA000935FAC /* Release */, 591 | ); 592 | defaultConfigurationIsVisible = 0; 593 | defaultConfigurationName = Release; 594 | }; 595 | 9264FE8F1393ECA000935FAC /* Build configuration list for PBXNativeTarget "Hues" */ = { 596 | isa = XCConfigurationList; 597 | buildConfigurations = ( 598 | 9264FE901393ECA000935FAC /* Debug */, 599 | 9264FE911393ECA000935FAC /* Release */, 600 | ); 601 | defaultConfigurationIsVisible = 0; 602 | defaultConfigurationName = Release; 603 | }; 604 | 9264FE921393ECA000935FAC /* Build configuration list for PBXNativeTarget "HuesTests" */ = { 605 | isa = XCConfigurationList; 606 | buildConfigurations = ( 607 | 9264FE931393ECA000935FAC /* Debug */, 608 | 9264FE941393ECA000935FAC /* Release */, 609 | ); 610 | defaultConfigurationIsVisible = 0; 611 | defaultConfigurationName = Release; 612 | }; 613 | /* End XCConfigurationList section */ 614 | }; 615 | rootObject = 9264FE541393EC9F00935FAC /* Project object */; 616 | } 617 | -------------------------------------------------------------------------------- /Hues.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Hues.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Hues.xcodeproj/xcshareddata/xcschemes/Hues.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 57 | 59 | 65 | 66 | 67 | 68 | 69 | 70 | 78 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Hues 2 | 3 | Hues is a color picker for Mac OS X 10.10 and later, previously released by my now defunct company [Giant Comet](http://giantcomet.com/hues), now provided as free, open-source app. It is built on top of the OS X color picker, and adds some extra features like automatically copying the color to the clipboard and seeing different color formats. 4 | 5 | ![hues screenshot](http://cloud.zachwaugh.com/images/hues-github-screenshot.png) 6 | 7 | ## Alternatives 8 | 9 | Hues is a pretty simple app. If you're looking for something more full-featured, check out these great apps: 10 | 11 | - [ColorSnapper](http://www.colorsnapper.com/) 12 | - [Sip](https://itunes.apple.com/us/app/sip/id507257563?mt=12) 13 | - [xScope](http://xscopeapp.com/) 14 | 15 | ## To Do 16 | 17 | Hues hasn't been worked on since late 2011. Besides needing some updating and modernization (in progress), there's plenty other improvements to make: 18 | 19 | ### Features 20 | - [ ] Rework color formatter and support more formats, including custom formats 21 | - [ ] Add a menubar icon 22 | 23 | ## 2.0 24 | I had started on a Hues 2.0 that didn't rely on the system color picker, and re-implemented most of the features myself, with some improvements. This was in [beta](http://giantcomet.com/hues/beta/) when I shut the company down. There was a lot of custom code in there for color picking and conversion, and may be useful to some. That code is in the [2.0 branch](https://github.com/zachwaugh/hues/tree/2.0) wh 25 | 26 | ### Distribution 27 | - [ ] Sign with Developer ID 28 | - [ ] Add Sparkle auto-updating 29 | 30 | ### Modernization/updating 31 | - [x] Update to ARC (yes, it's that old) 32 | 33 | ## License 34 | 35 | Hues is released under the MIT license 36 | 37 | Copyright (c) 2014 Zach Waugh 38 | 39 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 40 | 41 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 42 | 43 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 44 | -------------------------------------------------------------------------------- /resources/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "icon_16x16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "icon_16x16@2x.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "icon_32x32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "icon_32x32@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "icon_128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "icon_128@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "icon_256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "icon_256@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "icon_512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "icon_512@2x.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /resources/Images.xcassets/AppIcon.appiconset/icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zachwaugh/hues/76277529f3dbe9b8a5887c1168c8eb1efbea48d8/resources/Images.xcassets/AppIcon.appiconset/icon_128.png -------------------------------------------------------------------------------- /resources/Images.xcassets/AppIcon.appiconset/icon_128@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zachwaugh/hues/76277529f3dbe9b8a5887c1168c8eb1efbea48d8/resources/Images.xcassets/AppIcon.appiconset/icon_128@2x.png -------------------------------------------------------------------------------- /resources/Images.xcassets/AppIcon.appiconset/icon_16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zachwaugh/hues/76277529f3dbe9b8a5887c1168c8eb1efbea48d8/resources/Images.xcassets/AppIcon.appiconset/icon_16x16.png -------------------------------------------------------------------------------- /resources/Images.xcassets/AppIcon.appiconset/icon_16x16@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zachwaugh/hues/76277529f3dbe9b8a5887c1168c8eb1efbea48d8/resources/Images.xcassets/AppIcon.appiconset/icon_16x16@2x.png -------------------------------------------------------------------------------- /resources/Images.xcassets/AppIcon.appiconset/icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zachwaugh/hues/76277529f3dbe9b8a5887c1168c8eb1efbea48d8/resources/Images.xcassets/AppIcon.appiconset/icon_256.png -------------------------------------------------------------------------------- /resources/Images.xcassets/AppIcon.appiconset/icon_256@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zachwaugh/hues/76277529f3dbe9b8a5887c1168c8eb1efbea48d8/resources/Images.xcassets/AppIcon.appiconset/icon_256@2x.png -------------------------------------------------------------------------------- /resources/Images.xcassets/AppIcon.appiconset/icon_32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zachwaugh/hues/76277529f3dbe9b8a5887c1168c8eb1efbea48d8/resources/Images.xcassets/AppIcon.appiconset/icon_32x32.png -------------------------------------------------------------------------------- /resources/Images.xcassets/AppIcon.appiconset/icon_32x32@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zachwaugh/hues/76277529f3dbe9b8a5887c1168c8eb1efbea48d8/resources/Images.xcassets/AppIcon.appiconset/icon_32x32@2x.png -------------------------------------------------------------------------------- /resources/Images.xcassets/AppIcon.appiconset/icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zachwaugh/hues/76277529f3dbe9b8a5887c1168c8eb1efbea48d8/resources/Images.xcassets/AppIcon.appiconset/icon_512.png -------------------------------------------------------------------------------- /resources/Images.xcassets/AppIcon.appiconset/icon_512@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zachwaugh/hues/76277529f3dbe9b8a5887c1168c8eb1efbea48d8/resources/Images.xcassets/AppIcon.appiconset/icon_512@2x.png -------------------------------------------------------------------------------- /source/Hues-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDocumentTypes 8 | 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.2 21 | CFBundleSignature 22 | ???? 23 | CFBundleURLTypes 24 | 25 | CFBundleVersion 26 | 2 27 | LSApplicationCategoryType 28 | public.app-category.developer-tools 29 | LSMinimumSystemVersion 30 | ${MACOSX_DEPLOYMENT_TARGET} 31 | NSMainNibFile 32 | MainMenu 33 | NSPrincipalClass 34 | NSApplication 35 | NSServices 36 | 37 | UTExportedTypeDeclarations 38 | 39 | UTImportedTypeDeclarations 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /source/Hues-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Hues' target in the 'Hues' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /source/HuesAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // HUAppDelegate.h 3 | // Hues 4 | // 5 | // Copyright (c) 2014 Zach Waugh 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | #import 26 | 27 | @class HuesPreferencesController; 28 | @class HuesWindowController; 29 | 30 | @interface HuesAppDelegate : NSObject 31 | 32 | @property (nonatomic, strong) HuesWindowController *mainController; 33 | @property (nonatomic, strong) HuesPreferencesController *preferencesController; 34 | @property (nonatomic, strong) IBOutlet NSMenu *historyMenu; 35 | 36 | - (void)showPreferences:(id)sender; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /source/HuesAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // HUAppDelegate.m 3 | // Hues 4 | // 5 | // Copyright (c) 2014 Zach Waugh 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | #import "HuesAppDelegate.h" 26 | #import "HuesPreferences.h" 27 | #import "HuesPreferencesController.h" 28 | #import "HuesWindowController.h" 29 | #import "HuesHistoryManager.h" 30 | 31 | @implementation HuesAppDelegate 32 | 33 | - (void)applicationWillFinishLaunching:(NSNotification *)notification { 34 | [HuesPreferences registerDefaults]; 35 | [NSColorPanel setPickerMask:[HuesPreferences pickerMask]]; 36 | } 37 | 38 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { 39 | self.mainController = [[HuesWindowController alloc] init]; 40 | } 41 | 42 | - (void)awakeFromNib { 43 | [HuesHistoryManager sharedManager].menu = self.historyMenu; 44 | } 45 | 46 | - (void)showPreferences:(id)sender { 47 | if (!self.preferencesController) { 48 | self.preferencesController = [[HuesPreferencesController alloc] initWithWindowNibName:@"HuesPreferences"]; 49 | } 50 | 51 | [self.preferencesController showWindow:sender]; 52 | } 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /source/HuesColorsView.h: -------------------------------------------------------------------------------- 1 | // 2 | // HuesColorsView.h 3 | // Hues 4 | // 5 | // Copyright (c) 2014 Zach Waugh 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | #import 26 | 27 | @interface HuesColorsView : NSView 28 | @end 29 | -------------------------------------------------------------------------------- /source/HuesColorsView.m: -------------------------------------------------------------------------------- 1 | // 2 | // HuesColorsView.m 3 | // Hues 4 | // 5 | // Copyright (c) 2014 Zach Waugh 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | #import "HuesColorsView.h" 26 | 27 | #define BACKGROUND_GRAY_VALUE 220 28 | #define BORDER_GRAY_VALUE 202 29 | #define BORDER_INSET 20 30 | #define TOP_SEPARATOR_OFFSET 130 31 | #define BOTTOM_SEPARATOR_OFFSET 68 32 | 33 | @implementation HuesColorsView 34 | 35 | - (void)drawRect:(NSRect)dirtyRect { 36 | NSColor *backgroundColor = [NSColor colorWithWhite:BACKGROUND_GRAY_VALUE / 255.0 alpha:1.0]; 37 | [backgroundColor set]; 38 | NSRectFill(self.bounds); 39 | 40 | [[NSColor colorWithWhite:BORDER_GRAY_VALUE / 255.0 alpha:1.0] set]; 41 | // Top border 42 | NSRectFill(NSMakeRect(0, self.bounds.size.height - 1, self.bounds.size.width, 1)); 43 | 44 | // Separator lines - this is a crappy way to do this, but currently the view doesn't resize vertically 45 | NSRectFill(NSMakeRect(BORDER_INSET, TOP_SEPARATOR_OFFSET, self.bounds.size.width - (BORDER_INSET * 2), 1)); 46 | NSRectFill(NSMakeRect(BORDER_INSET, BOTTOM_SEPARATOR_OFFSET, self.bounds.size.width - (BORDER_INSET * 2), 1)); 47 | } 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /source/HuesColorsView.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 34 | 45 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /source/HuesGlobal.h: -------------------------------------------------------------------------------- 1 | // 2 | // HuesGlobal.h 3 | // Hues 4 | // 5 | // Copyright (c) 2014 Zach Waugh 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | // Notifications 26 | extern NSString * const HuesUpdateColorNotification; 27 | 28 | // Pickers 29 | extern NSString * const HuesShowColorWheelPickerKey; 30 | extern NSString * const HuesShowColorSlidersGrayPickerKey; 31 | extern NSString * const HuesShowColorSlidersRGBPickerKey; 32 | extern NSString * const HuesShowColorSlidersCMYKPickerKey; 33 | extern NSString * const HuesShowColorSlidersHSBPickerKey; 34 | extern NSString * const HuesShowColorPalettesPickerKey; 35 | extern NSString * const HuesShowImagePalettesPickerKey; 36 | extern NSString * const HuesShowCrayonsPickerKey; 37 | 38 | enum { 39 | HuesHexRepresentation, 40 | HuesRGBRepresentation, 41 | HuesHSLRepresentation 42 | }; 43 | 44 | typedef NSInteger HuesColorRepresentation; 45 | -------------------------------------------------------------------------------- /source/HuesGlobal.m: -------------------------------------------------------------------------------- 1 | // 2 | // HuesGlobal.m 3 | // Hues 4 | // 5 | // Copyright (c) 2014 Zach Waugh 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | #import "HuesGlobal.h" 26 | 27 | // Notifications 28 | NSString * const HuesUpdateColorNotification = @"HuesUpdateColorNotification"; 29 | 30 | NSString * const HuesShowColorWheelPickerKey = @"HuesShowColorWheelPicker"; 31 | NSString * const HuesShowColorSlidersGrayPickerKey = @"HuesShowColorSlidersGrayPicker"; 32 | NSString * const HuesShowColorSlidersRGBPickerKey = @"HuesShowColorSlidersRGBPicker"; 33 | NSString * const HuesShowColorSlidersCMYKPickerKey = @"HuesShowColorSlidersCMYKPicker"; 34 | NSString * const HuesShowColorSlidersHSBPickerKey = @"HuesShowColorSlidersHSBPicker"; 35 | NSString * const HuesShowColorPalettesPickerKey = @"HuesShowColorPalettesPicker"; 36 | NSString * const HuesShowImagePalettesPickerKey = @"HuesShowImagePalettesPicker"; 37 | NSString * const HuesShowCrayonsPickerKey = @"HuesShowCrayonsPicker"; 38 | -------------------------------------------------------------------------------- /source/HuesHistoryManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // HuesHistoryManager.h 3 | // Hues 4 | // 5 | // Copyright (c) 2014 Zach Waugh 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | #import 26 | 27 | @interface HuesHistoryManager : NSObject 28 | 29 | @property (nonatomic, strong) NSMutableArray *history; 30 | @property (nonatomic, weak) NSMenu *menu; 31 | 32 | + (HuesHistoryManager *)sharedManager; 33 | - (void)addColor:(NSColor *)color; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /source/HuesHistoryManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // HuesHistoryManager.m 3 | // Hues 4 | // 5 | // Copyright (c) 2014 Zach Waugh 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | #import "HuesHistoryManager.h" 26 | #import "NSColor+Extras.h" 27 | #import "NSImage+Hues.h" 28 | #import "HuesGlobal.h" 29 | 30 | #define HUES_MAX_HISTORY_SIZE 25 31 | 32 | @interface HuesHistoryManager () 33 | 34 | - (void)colorChosen:(id)sender; 35 | 36 | @end 37 | 38 | @implementation HuesHistoryManager 39 | 40 | - (id)init { 41 | if ((self = [super init])) { 42 | self.history = [NSMutableArray arrayWithCapacity:HUES_MAX_HISTORY_SIZE]; 43 | } 44 | 45 | return self; 46 | } 47 | 48 | #pragma mark - Singleton 49 | 50 | + (HuesHistoryManager *)sharedManager { 51 | static HuesHistoryManager *_sharedManager = nil; 52 | static dispatch_once_t onceToken; 53 | dispatch_once(&onceToken, ^{ 54 | _sharedManager = [[HuesHistoryManager alloc] init]; 55 | }); 56 | 57 | return _sharedManager; 58 | } 59 | 60 | - (void)addColor:(NSColor *)color { 61 | // Don't add if same as last color 62 | if (self.history.count > 0 && [color.hues_hex isEqualToString:[self.history[0] hues_hex]]) return; 63 | 64 | // Ensure doesn't go past max history size 65 | if (self.history.count == HUES_MAX_HISTORY_SIZE) { 66 | [self.history removeLastObject]; 67 | } 68 | 69 | [self.history insertObject:color atIndex:0]; 70 | 71 | if (self.menu.numberOfItems == HUES_MAX_HISTORY_SIZE) { 72 | [self.menu removeItemAtIndex:HUES_MAX_HISTORY_SIZE - 1]; 73 | } 74 | 75 | NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:[color hues_hex] action:@selector(colorChosen:) keyEquivalent:@""]; 76 | [item setImage:[NSImage imageWithColor:color]]; 77 | [item setTarget:self]; 78 | [self.menu insertItem:item atIndex:0]; 79 | } 80 | 81 | - (void)colorChosen:(id)sender { 82 | NSInteger index = [self.menu indexOfItem:sender]; 83 | NSColor *color = self.history[index]; 84 | [NSNotificationCenter.defaultCenter postNotificationName:HuesUpdateColorNotification object:color]; 85 | } 86 | 87 | @end 88 | -------------------------------------------------------------------------------- /source/HuesPreferences.h: -------------------------------------------------------------------------------- 1 | // 2 | // HUPreferences.h 3 | // Hues 4 | // 5 | // Copyright (c) 2014 Zach Waugh 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | #import 26 | #import "HuesGlobal.h" 27 | 28 | @interface HuesPreferences : NSObject 29 | 30 | + (void)registerDefaults; 31 | + (BOOL)copyToClipboard; 32 | + (void)setCopyToClipboard:(BOOL)copy; 33 | 34 | + (HuesColorRepresentation)defaultRepresentation; 35 | + (NSString *)hexFormat; 36 | + (NSString *)rgbFormat; 37 | + (NSString *)rgbaFormat; 38 | + (NSString *)hsbFormat; 39 | + (NSString *)hslFormat; 40 | + (NSString *)hslaFormat; 41 | + (NSUInteger)pickerMask; 42 | 43 | + (BOOL)useLowercase; 44 | + (void)setUseLowercase:(BOOL)lowercase; 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /source/HuesPreferences.m: -------------------------------------------------------------------------------- 1 | // 2 | // HUPreferences.m 3 | // Hues 4 | // 5 | // Copyright (c) 2014 Zach Waugh 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | #import "HuesPreferences.h" 26 | 27 | NSString * const HuesCopyToClipboardKey = @"HuesCopyToClipboard"; 28 | NSString * const HuesUseLowercaseKey = @"HuesUseLowercase"; 29 | NSString * const HuesDefaultColorRepresentationKey = @"HuesDefaultColorRepresentation"; 30 | NSString * const HuesHexFormatKey = @"HuesHexFormat"; 31 | NSString * const HuesRGBFormatKey = @"HuesRGBFormat"; 32 | NSString * const HuesRGBAFormatKey = @"HuesRGBAFormat"; 33 | NSString * const HuesHSBFormatKey = @"HuesHSBFormat"; 34 | NSString * const HuesHSLFormatKey = @"HuesHSLFormat"; 35 | NSString * const HuesHSLAFormatKey = @"HuesHSLAFormat"; 36 | 37 | @implementation HuesPreferences 38 | 39 | + (void)registerDefaults { 40 | NSMutableDictionary *defaults = [NSMutableDictionary dictionary]; 41 | 42 | // Auto copy to clipboard on 43 | [defaults setObject:@YES forKey:HuesCopyToClipboardKey]; 44 | 45 | // Hex is default 46 | [defaults setObject:@(HuesHexRepresentation) forKey:HuesDefaultColorRepresentationKey]; 47 | 48 | // Don't default to lowercase 49 | [defaults setObject:@NO forKey:HuesUseLowercaseKey]; 50 | 51 | // Color formats 52 | [defaults setObject:@"#{r}{g}{b}" forKey:HuesHexFormatKey]; 53 | [defaults setObject:@"rgb({r}, {g}, {b})" forKey:HuesRGBFormatKey]; 54 | [defaults setObject:@"rgba({r}, {g}, {b}, {a})" forKey:HuesRGBAFormatKey]; 55 | [defaults setObject:@"hsb({h}, {s}%, {b}%)" forKey:HuesHSBFormatKey]; 56 | [defaults setObject:@"hsl({h}, {s}%, {l}%)" forKey:HuesHSLFormatKey]; 57 | [defaults setObject:@"hsla({h}, {s}%, {l}%, {a})" forKey:HuesHSLAFormatKey]; 58 | 59 | // Color Pickers 60 | [defaults setObject:@YES forKey:HuesShowColorWheelPickerKey]; 61 | [defaults setObject:@YES forKey:HuesShowColorSlidersGrayPickerKey]; 62 | [defaults setObject:@YES forKey:HuesShowColorSlidersRGBPickerKey]; 63 | [defaults setObject:@YES forKey:HuesShowColorSlidersCMYKPickerKey]; 64 | [defaults setObject:@YES forKey:HuesShowColorSlidersHSBPickerKey]; 65 | [defaults setObject:@YES forKey:HuesShowColorPalettesPickerKey]; 66 | [defaults setObject:@YES forKey:HuesShowImagePalettesPickerKey]; 67 | [defaults setObject:@YES forKey:HuesShowCrayonsPickerKey]; 68 | 69 | [NSUserDefaults.standardUserDefaults registerDefaults:defaults]; 70 | } 71 | 72 | + (HuesColorRepresentation)defaultRepresentation { 73 | return [NSUserDefaults.standardUserDefaults integerForKey:HuesDefaultColorRepresentationKey]; 74 | } 75 | 76 | + (BOOL)useLowercase { 77 | return [NSUserDefaults.standardUserDefaults boolForKey:HuesUseLowercaseKey]; 78 | } 79 | 80 | + (void)setUseLowercase:(BOOL)lowercase { 81 | [NSUserDefaults.standardUserDefaults setBool:lowercase forKey:HuesUseLowercaseKey]; 82 | } 83 | 84 | + (NSString *)hexFormat { 85 | return [NSUserDefaults.standardUserDefaults stringForKey:HuesHexFormatKey]; 86 | } 87 | 88 | + (NSString *)rgbFormat { 89 | return [NSUserDefaults.standardUserDefaults stringForKey:HuesRGBFormatKey]; 90 | } 91 | 92 | + (NSString *)rgbaFormat { 93 | return [NSUserDefaults.standardUserDefaults stringForKey:HuesRGBAFormatKey]; 94 | } 95 | 96 | + (NSString *)hsbFormat { 97 | return [NSUserDefaults.standardUserDefaults stringForKey:HuesHSBFormatKey]; 98 | } 99 | 100 | + (NSString *)hslFormat { 101 | return [NSUserDefaults.standardUserDefaults stringForKey:HuesHSLFormatKey]; 102 | } 103 | 104 | + (NSString *)hslaFormat { 105 | return [NSUserDefaults.standardUserDefaults stringForKey:HuesHSLAFormatKey]; 106 | } 107 | 108 | + (BOOL)copyToClipboard { 109 | return [NSUserDefaults.standardUserDefaults boolForKey:HuesCopyToClipboardKey]; 110 | } 111 | 112 | + (void)setCopyToClipboard:(BOOL)copy { 113 | [NSUserDefaults.standardUserDefaults setBool:copy forKey:HuesCopyToClipboardKey]; 114 | [NSUserDefaults.standardUserDefaults synchronize]; 115 | } 116 | 117 | + (NSUInteger)pickerMask { 118 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 119 | 120 | NSUInteger colorWheel = ([defaults boolForKey:HuesShowColorWheelPickerKey]) ? NSColorPanelWheelModeMask : 0; 121 | NSUInteger colorSliderGrayscale = ([defaults boolForKey:HuesShowColorSlidersGrayPickerKey]) ? NSColorPanelGrayModeMask : 0; 122 | NSUInteger colorSliderRGB = ([defaults boolForKey:HuesShowColorSlidersRGBPickerKey]) ? NSColorPanelRGBModeMask : 0; 123 | NSUInteger colorSliderCMYK = ([defaults boolForKey:HuesShowColorSlidersCMYKPickerKey]) ? NSColorPanelCMYKModeMask : 0; 124 | NSUInteger colorSliderHSB = ([defaults boolForKey:HuesShowColorSlidersHSBPickerKey]) ? NSColorPanelHSBModeMask : 0; 125 | NSUInteger colorPalettes = ([defaults boolForKey:HuesShowColorPalettesPickerKey]) ? NSColorPanelColorListModeMask : 0; 126 | NSUInteger imagePalettes = ([defaults boolForKey:HuesShowImagePalettesPickerKey]) ? NSColorPanelCustomPaletteModeMask : 0; 127 | NSUInteger crayons = ([defaults boolForKey:HuesShowCrayonsPickerKey]) ? NSColorPanelCrayonModeMask : 0; 128 | 129 | return (colorWheel | colorSliderGrayscale | colorSliderRGB | colorSliderCMYK | colorSliderHSB | colorPalettes | imagePalettes | crayons); 130 | } 131 | 132 | @end 133 | -------------------------------------------------------------------------------- /source/HuesPreferences.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 |
137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 |
187 |
188 |
189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 |
199 |
200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 222 | 233 | 244 | 255 | 266 | 277 | 288 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 |
323 | 324 | 325 | 326 | 327 | 328 |
329 | -------------------------------------------------------------------------------- /source/HuesPreferencesController.h: -------------------------------------------------------------------------------- 1 | // 2 | // HuesPreferencesController.h 3 | // Hues 4 | // 5 | // Copyright (c) 2014 Zach Waugh 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | #import 26 | 27 | @interface HuesPreferencesController : NSWindowController 28 | 29 | @property (nonatomic, strong) NSString *currentToolbarIdentifier; 30 | @property (nonatomic, weak) NSView *currentView; 31 | @property (nonatomic, weak) IBOutlet NSToolbar *toolbar; 32 | @property (nonatomic, strong) IBOutlet NSView *view; 33 | @property (nonatomic, strong) IBOutlet NSView *generalView; 34 | @property (nonatomic, strong) IBOutlet NSView *colorPickersView; 35 | @property (nonatomic, strong) IBOutlet NSView *advancedView; 36 | 37 | - (void)toolbarItemSelected:(id)sender; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /source/HuesPreferencesController.m: -------------------------------------------------------------------------------- 1 | // 2 | // HuesPreferencesController.m 3 | // Hues 4 | // 5 | // Copyright (c) 2014 Zach Waugh 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | #import "HuesPreferencesController.h" 26 | 27 | static NSString * const HuesGeneralToolbarIdentifier = @"general"; 28 | static NSString * const HuesColorPickersToolbarIdentifier = @"colorpickers"; 29 | static NSString * const HuesAdvancedToolbarIdentifier = @"advanced"; 30 | 31 | @implementation HuesPreferencesController 32 | 33 | - (void)awakeFromNib { 34 | self.currentToolbarIdentifier = HuesGeneralToolbarIdentifier; 35 | [self.toolbar setSelectedItemIdentifier:HuesGeneralToolbarIdentifier]; 36 | self.window.title = @"General"; 37 | self.currentView = self.generalView; 38 | } 39 | 40 | - (void)toolbarItemSelected:(id)sender { 41 | NSString *identifier = [sender itemIdentifier]; 42 | if ([identifier isEqualToString:self.currentToolbarIdentifier]) return; 43 | 44 | self.currentToolbarIdentifier = identifier; 45 | [self.toolbar setSelectedItemIdentifier:identifier]; 46 | 47 | if ([identifier isEqualToString:HuesGeneralToolbarIdentifier]) { 48 | self.window.title = @"General"; 49 | self.currentView = self.generalView; 50 | } else if ([identifier isEqualToString:HuesColorPickersToolbarIdentifier]) { 51 | self.window.title = @"Color Pickers"; 52 | self.currentView = self.colorPickersView; 53 | } else if ([identifier isEqualToString:HuesAdvancedToolbarIdentifier]) { 54 | self.window.title = @"Advanced"; 55 | self.currentView = self.advancedView; 56 | } 57 | } 58 | 59 | - (void)setCurrentView:(NSView *)aView { 60 | NSRect newFrame = self.window.frame; 61 | newFrame.size.height = aView.frame.size.height + (self.window.frame.size.height - self.view.frame.size.height); 62 | newFrame.origin.y += (self.view.frame.size.height - aView.frame.size.height); 63 | 64 | [_currentView removeFromSuperview]; 65 | [[self window] setFrame:newFrame display:YES animate:YES]; 66 | [self.view addSubview:aView]; 67 | 68 | _currentView = aView; 69 | } 70 | 71 | @end 72 | -------------------------------------------------------------------------------- /source/HuesWindowController.h: -------------------------------------------------------------------------------- 1 | // 2 | // HuesMainController.h 3 | // Hues 4 | // 5 | // Copyright (c) 2014 Zach Waugh 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | #import 26 | 27 | @class HuesColorsView; 28 | 29 | @interface HuesWindowController : NSObject 30 | 31 | @property (nonatomic, strong) NSColorPanel *colorPanel; 32 | @property (nonatomic, strong) IBOutlet NSView *colorsView; 33 | @property (nonatomic, weak) IBOutlet NSTextField *hexField; 34 | @property (nonatomic, weak) IBOutlet NSTextField *rgbLabel; 35 | @property (nonatomic, weak) IBOutlet NSTextField *hslLabel; 36 | 37 | - (IBAction)copyHex:(id)sender; 38 | - (IBAction)copyRGB:(id)sender; 39 | - (IBAction)copyHSL:(id)sender; 40 | - (void)updateColor:(NSNotification *)notification; 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /source/HuesWindowController.m: -------------------------------------------------------------------------------- 1 | // 2 | // HuesMainController.m 3 | // Hues 4 | // 5 | // Copyright (c) 2014 Zach Waugh 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | // NSColorPanelWheelModeMask - Color Wheel 26 | // NSColorPanelGrayModeMask - Color Sliders 27 | // NSColorPanelRGBModeMask - Color Sliders 28 | // NSColorPanelCMYKModeMask - Color Sliders 29 | // NSColorPanelHSBModeMask - Color Sliders 30 | // NSColorPanelColorListModeMask - Color Palettes 31 | // NSColorPanelCustomPaletteModeMask - Image Palettes 32 | // NSColorPanelCrayonModeMask - Crayons 33 | // NSColorPanelAllModesMask - All 34 | 35 | #import "HuesWindowController.h" 36 | #import "HuesColorsView.h" 37 | #import "HuesPreferences.h" 38 | #import "HuesHistoryManager.h" 39 | #import "HuesGlobal.h" 40 | #import "NSColor+Extras.h" 41 | 42 | @interface HuesWindowController () 43 | 44 | - (void)copyToClipboard:(NSString *)value; 45 | - (void)updateLabelsWithColor:(NSColor *)color; 46 | 47 | @end 48 | 49 | @implementation HuesWindowController 50 | 51 | - (id)init { 52 | self = [super init]; 53 | if (!self) return nil; 54 | 55 | self.colorPanel = [NSColorPanel sharedColorPanel]; 56 | [self.colorPanel setStyleMask:NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask]; 57 | [self.colorPanel setTitle:@"Hues"]; 58 | [self.colorPanel setDelegate:self]; 59 | [self.colorPanel setShowsAlpha:YES]; 60 | [self.colorPanel setFloatingPanel:NO]; 61 | [self.colorPanel setHidesOnDeactivate:NO]; 62 | [self.colorPanel setShowsAlpha:YES]; 63 | [self.colorPanel setTarget:self]; 64 | [self.colorPanel setAction:@selector(colorChanged:)]; 65 | [self.colorPanel setMaxSize:NSMakeSize(FLT_MAX, FLT_MAX)]; 66 | 67 | [NSBundle.mainBundle loadNibNamed:@"HuesColorsView" owner:self topLevelObjects:nil]; 68 | [self updateLabelsWithColor:[self.colorPanel color]]; 69 | [self.colorPanel setAccessoryView:self.colorsView]; 70 | 71 | [self.colorPanel center]; 72 | [self.colorPanel makeKeyAndOrderFront:nil]; 73 | 74 | [NSNotificationCenter.defaultCenter addObserver:self selector:@selector(updateColor:) name:HuesUpdateColorNotification object:nil]; 75 | 76 | return self; 77 | } 78 | 79 | - (void)dealloc 80 | { 81 | [NSNotificationCenter.defaultCenter removeObserver:self]; 82 | } 83 | 84 | - (void)colorChanged:(id)sender { 85 | NSColor *color = [sender color]; 86 | [HuesHistoryManager.sharedManager addColor:color]; 87 | 88 | if (HuesPreferences.copyToClipboard) { 89 | if ([HuesPreferences defaultRepresentation] == HuesHexRepresentation) { 90 | [self copyToClipboard:[color hues_hex]]; 91 | } else if ([HuesPreferences defaultRepresentation] == HuesRGBRepresentation) { 92 | [self copyToClipboard:[color hues_rgb]]; 93 | } else if ([HuesPreferences defaultRepresentation] == HuesHSLRepresentation) { 94 | [self copyToClipboard:[color hues_hsb]]; 95 | } 96 | } 97 | 98 | [self updateLabelsWithColor:color]; 99 | } 100 | 101 | - (void)updateColor:(NSNotification *)notification { 102 | NSColor *color = [notification object]; 103 | [self.colorPanel setColor:color]; 104 | [self updateLabelsWithColor:color]; 105 | } 106 | 107 | - (void)updateLabelsWithColor:(NSColor *)color { 108 | // Setup overlay text attributes 109 | NSShadow *shadow = [[NSShadow alloc] init]; 110 | [shadow setShadowColor:[NSColor colorWithCalibratedWhite:1.0 alpha:0.5]]; 111 | [shadow setShadowOffset:NSMakeSize(0, -1)]; 112 | NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:shadow, NSShadowAttributeName, [NSFont fontWithName:@"Lucida Grande" size:14.0], NSFontAttributeName, nil]; 113 | 114 | NSAttributedString *hexString = [[NSAttributedString alloc] initWithString:[color hues_hex] attributes:attributes]; 115 | NSAttributedString *rgbString = [[NSAttributedString alloc] initWithString:[color hues_rgb] attributes:attributes]; 116 | NSAttributedString *hslString = [[NSAttributedString alloc] initWithString:[color hues_hsl] attributes:attributes]; 117 | 118 | [self.hexField setAttributedStringValue:hexString]; 119 | [self.rgbLabel setAttributedStringValue:rgbString]; 120 | [self.hslLabel setAttributedStringValue:hslString]; 121 | } 122 | 123 | - (void)copyHex:(id)sender { 124 | [self copyToClipboard:[[[NSColorPanel sharedColorPanel] color] hues_hex]]; 125 | } 126 | 127 | - (void)copyRGB:(id)sender { 128 | [self copyToClipboard:[[[NSColorPanel sharedColorPanel] color] hues_rgb]]; 129 | } 130 | 131 | - (void)copyHSL:(id)sender { 132 | [self copyToClipboard:[[[NSColorPanel sharedColorPanel] color] hues_hsl]]; 133 | } 134 | 135 | - (void)copyToClipboard:(NSString *)value { 136 | NSPasteboard *pasteboard = NSPasteboard.generalPasteboard; 137 | [pasteboard declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:self]; 138 | [pasteboard setString:value forType:NSStringPboardType]; 139 | } 140 | 141 | #pragma mark - Color input 142 | 143 | - (void)controlTextDidChange:(NSNotification *)notification { 144 | if (notification.object == self.hexField) { 145 | NSString *value = self.hexField.stringValue; 146 | NSColor *newColor = [NSColor hues_colorFromHex:value]; 147 | 148 | if (newColor) { 149 | [self updateLabelsWithColor:newColor]; 150 | [self.colorPanel setColor:newColor]; 151 | } 152 | } 153 | } 154 | 155 | // Make sure app quits after panel is closed 156 | - (void)windowWillClose:(NSNotification *)notification { 157 | [[NSApplication sharedApplication] terminate:nil]; 158 | } 159 | 160 | @end 161 | -------------------------------------------------------------------------------- /source/MainMenu.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | -------------------------------------------------------------------------------- /source/NSColor+Extras.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSColor+Extras.h 3 | // Hues 4 | // 5 | // Copyright (c) 2014 Zach Waugh 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | #import 26 | 27 | @interface NSColor (Extras) 28 | 29 | - (NSString *)hues_hex; 30 | - (NSString *)hues_hexWithLowercase:(BOOL)lowercase; 31 | - (NSString *)hues_hexWithFormat:(NSString *)format; 32 | - (NSString *)hues_hexWithFormat:(NSString *)format useLowercase:(BOOL)lowercase; 33 | - (NSString *)hues_rgb; 34 | - (NSString *)hues_rgbWithDefaultFormat; 35 | - (NSString *)hues_rgbWithFormat:(NSString *)format; 36 | - (NSString *)hues_rgbaWithFormat:(NSString *)format; 37 | - (NSString *)hues_hsb; 38 | - (NSString *)hues_hsl; 39 | - (NSString *)hues_hslWithDefaultFormat; 40 | - (NSString *)hues_hslWithFormat:(NSString *)format; 41 | - (NSString *)hues_hslaWithFormat:(NSString *)format; 42 | - (NSColor *)hues_convertedColor; 43 | + (NSColor *)hues_colorFromHex:(NSString *)hex; 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /source/NSColor+Extras.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSColor+Extras.m 3 | // Hues 4 | // 5 | // Copyright (c) 2014 Zach Waugh 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | #import "NSColor+Extras.h" 26 | #import "HuesPreferences.h" 27 | 28 | @implementation NSColor (Extras) 29 | 30 | - (NSString *)hues_hex { 31 | return [self hues_hexWithFormat:HuesPreferences.hexFormat useLowercase:HuesPreferences.useLowercase]; 32 | } 33 | 34 | - (NSString *)hues_hexWithLowercase:(BOOL)lowercase { 35 | return [self hues_hexWithFormat:@"#{r}{g}{b}" useLowercase:lowercase]; 36 | } 37 | 38 | - (NSString *)hues_hexWithFormat:(NSString *)format { 39 | return [self hues_hexWithFormat:format useLowercase:NO]; 40 | } 41 | 42 | - (NSString *)hues_hexWithFormat:(NSString *)format useLowercase:(BOOL)lowercase { 43 | NSInteger red, green, blue; 44 | NSString *redHexValue, *greenHexValue, *blueHexValue; 45 | 46 | NSColor *color = [self hues_convertedColor]; 47 | 48 | if (color) { 49 | red = roundf([color redComponent] * 255.0f); 50 | green = roundf([color greenComponent] * 255.0f); 51 | blue = roundf([color blueComponent] * 255.0f); 52 | 53 | redHexValue = [NSString stringWithFormat:@"%02x", (int)red].uppercaseString; 54 | greenHexValue = [NSString stringWithFormat:@"%02x", (int)green].uppercaseString; 55 | blueHexValue = [NSString stringWithFormat:@"%02x", (int)blue].uppercaseString; 56 | 57 | NSString *output = [format stringByReplacingOccurrencesOfString:@"{r}" withString:redHexValue]; 58 | output = [output stringByReplacingOccurrencesOfString:@"{g}" withString:greenHexValue]; 59 | output = [output stringByReplacingOccurrencesOfString:@"{b}" withString:blueHexValue]; 60 | 61 | return (lowercase) ? [output lowercaseString] : output; 62 | } 63 | 64 | return nil; 65 | } 66 | 67 | - (NSString *)hues_rgb 68 | { 69 | return (self.alphaComponent < 1) ? [self hues_rgbaWithFormat:[HuesPreferences rgbaFormat]] : [self hues_rgbWithFormat:[HuesPreferences rgbFormat]]; 70 | } 71 | 72 | - (NSString *)hues_rgbWithDefaultFormat { 73 | return (self.alphaComponent < 1) ? [self hues_rgbaWithFormat:@"rgba({r}, {g}, {b}, {a})"] : [self hues_rgbWithFormat:@"rgb({r}, {g}, {b})"]; 74 | } 75 | 76 | - (NSString *)hues_rgbWithFormat:(NSString *)format { 77 | NSInteger red, green, blue; 78 | NSColor *color = [self hues_convertedColor]; 79 | 80 | if (color) { 81 | red = round(color.redComponent * 255.0f); 82 | green = round(color.greenComponent * 255.0f); 83 | blue = round(color.blueComponent * 255.0f); 84 | 85 | NSString *output; 86 | output = [format stringByReplacingOccurrencesOfString:@"{r}" withString:[NSString stringWithFormat:@"%d", (int)red]]; 87 | output = [output stringByReplacingOccurrencesOfString:@"{g}" withString:[NSString stringWithFormat:@"%d", (int)green]]; 88 | output = [output stringByReplacingOccurrencesOfString:@"{b}" withString:[NSString stringWithFormat:@"%d", (int)blue]]; 89 | 90 | return output; 91 | } 92 | 93 | return nil; 94 | } 95 | 96 | - (NSString *)hues_rgbaWithFormat:(NSString *)format { 97 | CGFloat alpha; 98 | int red, green, blue; 99 | 100 | NSColor *color = [self hues_convertedColor]; 101 | 102 | if (color) { 103 | red = roundf([color redComponent] * 255.0f); 104 | green = roundf([color greenComponent] * 255.0f); 105 | blue = roundf([color blueComponent] * 255.0f); 106 | alpha = [color alphaComponent]; 107 | 108 | NSString *output; 109 | output = [format stringByReplacingOccurrencesOfString:@"{r}" withString:[NSString stringWithFormat:@"%d", red]]; 110 | output = [output stringByReplacingOccurrencesOfString:@"{g}" withString:[NSString stringWithFormat:@"%d", green]]; 111 | output = [output stringByReplacingOccurrencesOfString:@"{b}" withString:[NSString stringWithFormat:@"%d", blue]]; 112 | output = [output stringByReplacingOccurrencesOfString:@"{a}" withString:[NSString stringWithFormat:@"%.2f", alpha]]; 113 | 114 | return output; 115 | } 116 | 117 | return nil; 118 | } 119 | 120 | - (NSString *)hues_hsb { 121 | int hue, saturation, brightness; 122 | 123 | NSColor *color = [self hues_convertedColor]; 124 | 125 | if (color) { 126 | hue = roundf([color hueComponent] * 360.0f); 127 | brightness = roundf([color brightnessComponent] * 100.0f); 128 | saturation = roundf([color saturationComponent] * 100.0f); 129 | 130 | NSString *output; 131 | NSString *format = [HuesPreferences hsbFormat]; 132 | 133 | output = [format stringByReplacingOccurrencesOfString:@"{h}" withString:[NSString stringWithFormat:@"%d", hue]]; 134 | output = [output stringByReplacingOccurrencesOfString:@"{s}" withString:[NSString stringWithFormat:@"%d", saturation]]; 135 | output = [output stringByReplacingOccurrencesOfString:@"{b}" withString:[NSString stringWithFormat:@"%d", brightness]]; 136 | 137 | 138 | return output; 139 | } 140 | 141 | return nil; 142 | } 143 | 144 | - (NSString *)hues_hsl { 145 | return ([self alphaComponent] < 1) ? [self hues_hslaWithFormat:[HuesPreferences hslaFormat]] : [self hues_hslWithFormat:[HuesPreferences hslFormat]]; 146 | } 147 | 148 | - (NSString *)hues_hslWithDefaultFormat { 149 | return ([self alphaComponent] < 1) ? [self hues_hslaWithFormat:@"hsla({h}, {s}%, {l}%, {a})"] : [self hues_hslWithFormat:@"hsl({h}, {s}%, {l}%)"]; 150 | } 151 | 152 | - (NSString *)hues_hslWithFormat:(NSString *)format { 153 | int hue; 154 | float red, green, blue, alpha, saturation, lightness, max, min, delta; 155 | 156 | NSColor *color = [self hues_convertedColor]; 157 | 158 | if (color) { 159 | red = [color redComponent]; 160 | green = [color greenComponent]; 161 | blue = [color blueComponent]; 162 | alpha = [color alphaComponent]; 163 | 164 | max = MAX(red, MAX(green, blue)); 165 | min = MIN(red, MIN(green, blue)); 166 | 167 | hue = roundf([color hueComponent] * 360.0f); 168 | hue = (hue >= 360) ? 0 : hue; 169 | 170 | lightness = (max + min) / 2; 171 | 172 | if (max == min) { 173 | hue = 0; 174 | saturation = 0; 175 | } else { 176 | delta = max - min; 177 | saturation = (lightness > 0.5) ? delta / (2 - max - min) : delta / (max + min); 178 | } 179 | 180 | NSString *output; 181 | output = [format stringByReplacingOccurrencesOfString:@"{h}" withString:[NSString stringWithFormat:@"%d", hue]]; 182 | output = [output stringByReplacingOccurrencesOfString:@"{s}" withString:[NSString stringWithFormat:@"%d", (int)roundf(saturation * 100.0f)]]; 183 | output = [output stringByReplacingOccurrencesOfString:@"{l}" withString:[NSString stringWithFormat:@"%d", (int)roundf(lightness * 100.0f)]]; 184 | 185 | return output; 186 | } 187 | 188 | return nil; 189 | } 190 | 191 | - (NSString *)hues_hslaWithFormat:(NSString *)format { 192 | NSInteger hue; 193 | CGFloat red, green, blue, alpha, saturation, lightness, max, min, delta; 194 | 195 | NSColor *color = [self hues_convertedColor]; 196 | 197 | if (color) { 198 | red = color.redComponent; 199 | green = color.greenComponent; 200 | blue = color.blueComponent; 201 | alpha = color.alphaComponent; 202 | 203 | max = MAX(red, MAX(green, blue)); 204 | min = MIN(red, MIN(green, blue)); 205 | 206 | hue = roundf(color.hueComponent * 360.0f); 207 | lightness = (max + min) / 2; 208 | 209 | if (max == min) { 210 | hue = 0; 211 | saturation = 0; 212 | } else { 213 | delta = max - min; 214 | saturation = (lightness > 0.5) ? delta / (2 - max - min) : delta / (max + min); 215 | } 216 | 217 | NSString *output; 218 | output = [format stringByReplacingOccurrencesOfString:@"{h}" withString:[NSString stringWithFormat:@"%d", (int)hue]]; 219 | output = [output stringByReplacingOccurrencesOfString:@"{s}" withString:[NSString stringWithFormat:@"%d", (int)roundf(saturation * 100.0f)]]; 220 | output = [output stringByReplacingOccurrencesOfString:@"{l}" withString:[NSString stringWithFormat:@"%d", (int)roundf(lightness * 100.0f)]]; 221 | output = [output stringByReplacingOccurrencesOfString:@"{a}" withString:[NSString stringWithFormat:@"%.2f", alpha]]; 222 | 223 | return output; 224 | } 225 | 226 | return nil; 227 | } 228 | 229 | - (NSColor *)hues_convertedColor { 230 | if (self.colorSpaceName != NSCalibratedRGBColorSpace && self.colorSpaceName != NSDeviceRGBColorSpace) { 231 | return [self colorUsingColorSpaceName:NSCalibratedRGBColorSpace]; 232 | } else { 233 | return self; 234 | } 235 | } 236 | 237 | + (NSColor *)hues_colorFromHex:(NSString *)hex { 238 | // remove any # signs 239 | hex = [hex stringByReplacingOccurrencesOfString:@"#" withString:@""]; 240 | 241 | if (hex.length < 6) return nil; 242 | if (hex.length > 6) hex = [hex substringToIndex:6]; 243 | 244 | NSColor *result = nil; 245 | unsigned int colorCode = 0; 246 | unsigned char redByte, greenByte, blueByte; 247 | 248 | if (hex) { 249 | NSScanner *scanner = [NSScanner scannerWithString:hex]; 250 | (void) [scanner scanHexInt:&colorCode]; // ignore error 251 | } 252 | 253 | redByte = (unsigned char) (colorCode >> 16); 254 | greenByte = (unsigned char) (colorCode >> 8); 255 | blueByte = (unsigned char) (colorCode); // masks off high bits 256 | result = [NSColor colorWithCalibratedRed:(float)redByte / 0xff green:(float)greenByte / 0xff blue:(float)blueByte / 0xff alpha:1.0]; 257 | 258 | return result; 259 | } 260 | 261 | @end 262 | -------------------------------------------------------------------------------- /source/NSImage+Hues.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSImage+Hues.h 3 | // Hues 4 | // 5 | // Copyright (c) 2014 Zach Waugh 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | #import 26 | 27 | @interface NSImage (Hues) 28 | 29 | + (NSImage *)imageWithColor:(NSColor *)color; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /source/NSImage+Hues.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSImage+Hues.m 3 | // Hues 4 | // 5 | // Copyright (c) 2014 Zach Waugh 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | #import "NSImage+Hues.h" 26 | 27 | @implementation NSImage (Hues) 28 | 29 | + (NSImage *)imageWithColor:(NSColor *)color { 30 | NSImage *image = [[NSImage alloc] initWithSize:NSMakeSize(10, 10)]; 31 | [image lockFocus]; 32 | [color set]; 33 | NSRectFill(NSMakeRect(0, 0, 10, 10)); 34 | [[NSColor colorWithCalibratedWhite:0.722 alpha:1.000] set]; 35 | [[NSBezierPath bezierPathWithRect:NSMakeRect(0.5, 0.5, 9, 9)] stroke]; 36 | [image unlockFocus]; 37 | 38 | return image; 39 | } 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /source/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /source/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Hues 4 | // 5 | // Created by Zach Waugh on 5/30/11. 6 | // Copyright 2011 Giant Comet. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | return NSApplicationMain(argc, (const char **)argv); 14 | } 15 | -------------------------------------------------------------------------------- /tests/HuesColorTest.m: -------------------------------------------------------------------------------- 1 | // 2 | // HuesColorTest.m 3 | // Hues 4 | // 5 | // Copyright (c) 2014 Zach Waugh 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | #import 26 | #import "NSColor+Extras.h" 27 | #import "HuesPreferences.h" 28 | 29 | @interface HuesColorTest : XCTestCase 30 | 31 | @end 32 | 33 | @implementation HuesColorTest 34 | 35 | - (void)setUp 36 | { 37 | [super setUp]; 38 | [HuesPreferences registerDefaults]; 39 | } 40 | 41 | - (void)tearDown 42 | { 43 | // Tear-down code here. 44 | [super tearDown]; 45 | } 46 | 47 | - (void)testHexFromColor 48 | { 49 | XCTAssertEqualObjects([[NSColor whiteColor] hues_hexWithLowercase:NO], @"#FFFFFF", @""); 50 | XCTAssertEqualObjects([[NSColor whiteColor] hues_hexWithLowercase:YES], @"#ffffff", @""); 51 | XCTAssertEqualObjects([[NSColor blackColor] hues_hexWithLowercase:NO], @"#000000", @""); 52 | 53 | XCTAssertEqualObjects([[NSColor colorWithCalibratedWhite:0 alpha:1] hues_hexWithLowercase:NO], @"#000000", @""); 54 | XCTAssertEqualObjects([[NSColor colorWithCalibratedWhite:0 alpha:0] hues_hexWithLowercase:NO], @"#000000", @""); 55 | 56 | 57 | XCTAssertEqualObjects([[NSColor colorWithCalibratedRed:1 green:1 blue:1 alpha:1] hues_hexWithLowercase:NO], @"#FFFFFF", @""); 58 | XCTAssertEqualObjects([[NSColor colorWithDeviceRed:1 green:1 blue:1 alpha:1] hues_hexWithLowercase:NO], @"#FFFFFF", @""); 59 | XCTAssertEqualObjects([[NSColor colorWithCalibratedRed:0 green:0 blue:0 alpha:1] hues_hexWithLowercase:NO], @"#000000", @""); 60 | XCTAssertEqualObjects([[NSColor colorWithDeviceRed:0 green:0 blue:0 alpha:1] hues_hexWithLowercase:NO], @"#000000", @""); 61 | XCTAssertEqualObjects([[NSColor colorWithCalibratedRed:0.5 green:0.5 blue:0.5 alpha:1] hues_hexWithLowercase:NO], @"#808080", @""); 62 | XCTAssertEqualObjects([[NSColor colorWithDeviceRed:0.5 green:0.5 blue:0.5 alpha:1] hues_hexWithLowercase:NO], @"#808080", @""); 63 | XCTAssertEqualObjects([[NSColor colorWithCalibratedRed:0.25 green:0.25 blue:0.25 alpha:1] hues_hexWithLowercase:NO], @"#404040", @""); 64 | XCTAssertEqualObjects([[NSColor colorWithDeviceRed:0.25 green:0.25 blue:0.25 alpha:1] hues_hexWithLowercase:NO], @"#404040", @""); 65 | XCTAssertEqualObjects([[NSColor colorWithCalibratedRed:0.1 green:0.1 blue:0.25 alpha:1] hues_hexWithLowercase:NO], @"#1A1A40", @""); 66 | XCTAssertEqualObjects([[NSColor colorWithDeviceRed:0.1 green:0.1 blue:0.25 alpha:1] hues_hexWithLowercase:NO], @"#1A1A40", @""); 67 | } 68 | 69 | - (void)testRGBFromColor 70 | { 71 | // test basic black and white 72 | XCTAssertEqualObjects([[NSColor whiteColor] hues_rgbWithDefaultFormat], @"rgb(255, 255, 255)", @""); 73 | XCTAssertEqualObjects([[NSColor blackColor] hues_rgbWithDefaultFormat], @"rgb(0, 0, 0)", @""); 74 | 75 | // test rgba is correctly returned 76 | XCTAssertEqualObjects([[NSColor colorWithCalibratedWhite:0 alpha:1] hues_rgbWithDefaultFormat], @"rgb(0, 0, 0)", @""); 77 | XCTAssertEqualObjects([[NSColor colorWithCalibratedWhite:0 alpha:0.5] hues_rgbWithDefaultFormat], @"rgba(0, 0, 0, 0.50)", @""); 78 | XCTAssertEqualObjects([[NSColor colorWithCalibratedWhite:0 alpha:0.25] hues_rgbWithDefaultFormat], @"rgba(0, 0, 0, 0.25)", @""); 79 | XCTAssertEqualObjects([[NSColor colorWithCalibratedWhite:0 alpha:0] hues_rgbWithDefaultFormat], @"rgba(0, 0, 0, 0.00)", @""); 80 | XCTAssertEqualObjects([[NSColor colorWithCalibratedWhite:1 alpha:1] hues_rgbWithDefaultFormat], @"rgb(255, 255, 255)", @""); 81 | XCTAssertEqualObjects([[NSColor colorWithCalibratedWhite:1 alpha:0.5] hues_rgbWithDefaultFormat], @"rgba(255, 255, 255, 0.50)", @""); 82 | XCTAssertEqualObjects([[NSColor colorWithCalibratedWhite:1 alpha:0.25] hues_rgbWithDefaultFormat], @"rgba(255, 255, 255, 0.25)", @""); 83 | XCTAssertEqualObjects([[NSColor colorWithCalibratedWhite:1 alpha:0] hues_rgbWithDefaultFormat], @"rgba(255, 255, 255, 0.00)", @""); 84 | 85 | // test various values - rgb 86 | XCTAssertEqualObjects([[NSColor colorWithCalibratedRed:1 green:1 blue:1 alpha:1] hues_rgbWithDefaultFormat], @"rgb(255, 255, 255)", @""); 87 | XCTAssertEqualObjects([[NSColor colorWithDeviceRed:1 green:1 blue:1 alpha:1] hues_rgbWithDefaultFormat], @"rgb(255, 255, 255)", @""); 88 | XCTAssertEqualObjects([[NSColor colorWithCalibratedRed:0 green:0 blue:0 alpha:1] hues_rgbWithDefaultFormat], @"rgb(0, 0, 0)", @""); 89 | XCTAssertEqualObjects([[NSColor colorWithDeviceRed:0 green:0 blue:0 alpha:1] hues_rgbWithDefaultFormat], @"rgb(0, 0, 0)", @""); 90 | XCTAssertEqualObjects([[NSColor colorWithCalibratedRed:0.5 green:0.5 blue:0.5 alpha:1] hues_rgbWithDefaultFormat], @"rgb(128, 128, 128)", @""); 91 | XCTAssertEqualObjects([[NSColor colorWithDeviceRed:0.5 green:0.5 blue:0.5 alpha:1] hues_rgbWithDefaultFormat], @"rgb(128, 128, 128)", @""); 92 | XCTAssertEqualObjects([[NSColor colorWithCalibratedRed:0.25 green:0.25 blue:0.25 alpha:1] hues_rgbWithDefaultFormat], @"rgb(64, 64, 64)", @""); 93 | XCTAssertEqualObjects([[NSColor colorWithDeviceRed:0.25 green:0.25 blue:0.25 alpha:1] hues_rgbWithDefaultFormat], @"rgb(64, 64, 64)", @""); 94 | XCTAssertEqualObjects([[NSColor colorWithCalibratedRed:0.1 green:0.1 blue:0.1 alpha:1] hues_rgbWithDefaultFormat], @"rgb(26, 26, 26)", @""); 95 | XCTAssertEqualObjects([[NSColor colorWithDeviceRed:0.1 green:0.1 blue:0.1 alpha:1] hues_rgbWithDefaultFormat], @"rgb(26, 26, 26)", @""); 96 | } 97 | 98 | 99 | - (void)testHSLFromColor 100 | { 101 | // test basic black and white 102 | XCTAssertEqualObjects([[NSColor whiteColor] hues_hslWithDefaultFormat], @"hsl(0, 0%, 100%)", @""); 103 | XCTAssertEqualObjects([[NSColor blackColor] hues_hslWithDefaultFormat], @"hsl(0, 0%, 0%)", @""); 104 | 105 | // test various colors 106 | XCTAssertEqualObjects([[NSColor colorWithCalibratedRed:0 green:1 blue:0 alpha:1] hues_hslWithDefaultFormat], @"hsl(120, 100%, 50%)", @""); 107 | XCTAssertEqualObjects([[NSColor colorWithDeviceRed:0 green:1 blue:0 alpha:1] hues_hslWithDefaultFormat], @"hsl(120, 100%, 50%)", @""); 108 | XCTAssertEqualObjects([[NSColor colorWithCalibratedRed:1 green:1 blue:0 alpha:1] hues_hslWithDefaultFormat], @"hsl(60, 100%, 50%)", @""); 109 | XCTAssertEqualObjects([[NSColor colorWithDeviceRed:1 green:1 blue:0 alpha:1] hues_hslWithDefaultFormat], @"hsl(60, 100%, 50%)", @""); 110 | XCTAssertEqualObjects([[NSColor colorWithCalibratedRed:1 green:0 blue:0 alpha:1] hues_hslWithDefaultFormat], @"hsl(0, 100%, 50%)", @""); 111 | XCTAssertEqualObjects([[NSColor colorWithCalibratedRed:1 green:0 blue:1 alpha:1] hues_hslWithDefaultFormat], @"hsl(300, 100%, 50%)", @""); 112 | 113 | // test hsla is returned 114 | XCTAssertEqualObjects([[NSColor colorWithCalibratedWhite:1 alpha:0.5] hues_hslWithDefaultFormat], @"hsla(0, 0%, 100%, 0.50)", @""); 115 | XCTAssertEqualObjects([[NSColor colorWithCalibratedWhite:0 alpha:0.5] hues_hslWithDefaultFormat], @"hsla(0, 0%, 0%, 0.50)", @""); 116 | XCTAssertEqualObjects([[NSColor colorWithCalibratedRed:0 green:1 blue:0 alpha:0.75] hues_hslWithDefaultFormat], @"hsla(120, 100%, 50%, 0.75)", @""); 117 | XCTAssertEqualObjects([[NSColor colorWithDeviceRed:0 green:1 blue:0 alpha:0.5] hues_hslWithDefaultFormat], @"hsla(120, 100%, 50%, 0.50)", @""); 118 | XCTAssertEqualObjects([[NSColor colorWithCalibratedRed:1 green:1 blue:0 alpha:0.25] hues_hslWithDefaultFormat], @"hsla(60, 100%, 50%, 0.25)", @""); 119 | XCTAssertEqualObjects([[NSColor colorWithDeviceRed:1 green:1 blue:0 alpha:0.1] hues_hslWithDefaultFormat], @"hsla(60, 100%, 50%, 0.10)", @""); 120 | } 121 | 122 | 123 | - (void)testHexFormatParsing 124 | { 125 | NSColor *color = [NSColor whiteColor]; 126 | 127 | XCTAssertEqualObjects([color hues_hexWithFormat:@"{r}"], @"FF", @""); 128 | XCTAssertEqualObjects([color hues_hexWithFormat:@"{r}" useLowercase:YES], @"ff", @""); 129 | XCTAssertEqualObjects([color hues_hexWithFormat:@"{g}"], @"FF", @""); 130 | XCTAssertEqualObjects([color hues_hexWithFormat:@"{b}"], @"FF", @""); 131 | XCTAssertEqualObjects([color hues_hexWithFormat:@"{r}{g}{b}"], @"FFFFFF", @""); 132 | XCTAssertEqualObjects([color hues_hexWithFormat:@"{r}{g}{b}" useLowercase:YES], @"ffffff", @""); 133 | XCTAssertEqualObjects([color hues_hexWithFormat:@"#{r}{g}{b}"], @"#FFFFFF", @""); 134 | XCTAssertEqualObjects([color hues_hexWithFormat:@"{r} {g} {b}"], @"FF FF FF", @""); 135 | XCTAssertEqualObjects([color hues_hexWithFormat:@"{r}-{g}-{b}"], @"FF-FF-FF", @""); 136 | XCTAssertEqualObjects([color hues_hexWithFormat:@"{r}_{g}_{b}"], @"FF_FF_FF", @""); 137 | XCTAssertEqualObjects([color hues_hexWithFormat:@"0x{r}{g}{b}"], @"0xFFFFFF", @""); 138 | XCTAssertEqualObjects([color hues_hexWithFormat:@"{{r}}{{g}}{{b}}"], @"{FF}{FF}{FF}", @""); 139 | 140 | color = [NSColor colorWithCalibratedRed:1 green:0.5 blue:0.25 alpha:1]; 141 | XCTAssertEqualObjects([color hues_hexWithFormat:@"{r}"], @"FF", @""); 142 | XCTAssertEqualObjects([color hues_hexWithFormat:@"{g}"], @"80", @""); 143 | XCTAssertEqualObjects([color hues_hexWithFormat:@"{b}"], @"40", @""); 144 | XCTAssertEqualObjects([color hues_hexWithFormat:@"{r}{g}{b}"], @"FF8040", @""); 145 | XCTAssertEqualObjects([color hues_hexWithFormat:@"#{r}{g}{b}"], @"#FF8040", @""); 146 | XCTAssertEqualObjects([color hues_hexWithFormat:@"{r} {g} {b}"], @"FF 80 40", @""); 147 | XCTAssertEqualObjects([color hues_hexWithFormat:@"{r}-{g}-{b}"], @"FF-80-40", @""); 148 | XCTAssertEqualObjects([color hues_hexWithFormat:@"{r}_{g}_{b}"], @"FF_80_40", @""); 149 | XCTAssertEqualObjects([color hues_hexWithFormat:@"0x{r}{g}{b}"], @"0xFF8040", @""); 150 | XCTAssertEqualObjects([color hues_hexWithFormat:@"{{r}}{{g}}{{b}}"], @"{FF}{80}{40}", @""); 151 | } 152 | 153 | 154 | - (void)testColorFromHex 155 | { 156 | // Test correct input length 157 | XCTAssertNil([NSColor hues_colorFromHex:@""], @"Input less than 6 characters should be nil"); 158 | XCTAssertNil([NSColor hues_colorFromHex:@"f"], @"Input less than 6 characters should be nil"); 159 | XCTAssertNil([NSColor hues_colorFromHex:@"ff"], @"Input less than 6 characters should be nil"); 160 | XCTAssertNil([NSColor hues_colorFromHex:@"fff"], @"Input less than 6 characters should be nil"); 161 | XCTAssertNil([NSColor hues_colorFromHex:@"ffff"], @"Input less than 6 characters should be nil"); 162 | XCTAssertNil([NSColor hues_colorFromHex:@"fffff"], @"Input less than 6 characters should be nil"); 163 | XCTAssertNil([NSColor hues_colorFromHex:@"#fffff"], @"Input less than 6 characters after stripping # should be nil"); 164 | 165 | // test same hex is returned 166 | XCTAssertEqualObjects([[NSColor hues_colorFromHex:@"FFFFFF"] hues_hexWithLowercase:NO], @"#FFFFFF", @"should return same hex"); 167 | XCTAssertEqualObjects([[NSColor hues_colorFromHex:@"000000"] hues_hexWithLowercase:NO], @"#000000", @"should return same hex"); 168 | XCTAssertEqualObjects([[NSColor hues_colorFromHex:@"00ff00"] hues_hexWithLowercase:NO], @"#00FF00", @"should return same hex"); 169 | XCTAssertEqualObjects([[NSColor hues_colorFromHex:@"CCCCCC"] hues_hexWithLowercase:NO], @"#CCCCCC", @"should return same hex"); 170 | XCTAssertEqualObjects([[NSColor hues_colorFromHex:@"abc369"] hues_hexWithLowercase:NO], @"#ABC369", @"should return same hex"); 171 | 172 | // test same hex with correct formatting 173 | XCTAssertEqualObjects([[NSColor hues_colorFromHex:@"ffffff"] hues_hexWithLowercase:YES], @"#ffffff", @"lowercase and should return same hex, lowercase"); 174 | XCTAssertEqualObjects([[NSColor hues_colorFromHex:@"ffffff"] hues_hexWithLowercase:NO], @"#FFFFFF", @"lowercase and should return same hex, uppercase"); 175 | XCTAssertEqualObjects([[NSColor hues_colorFromHex:@"FFFFFF"] hues_hexWithLowercase:YES], @"#ffffff", @"uppercase and should return same hex, lowercase"); 176 | 177 | 178 | // test extra input still works 179 | XCTAssertEqualObjects([[NSColor hues_colorFromHex:@"#FFFFFF"] hues_hexWithLowercase:NO], @"#FFFFFF", @"hex with # should return same hex"); 180 | XCTAssertEqualObjects([[NSColor hues_colorFromHex:@"#FFFFFFFFFFFFF"] hues_hexWithLowercase:NO], @"#FFFFFF", @"hex with extra digits and # should return same hex"); 181 | XCTAssertEqualObjects([[NSColor hues_colorFromHex:@"#CCCCCCfjfyefuf"] hues_hexWithLowercase:NO], @"#CCCCCC", @"hex with extra digits and # should return same hex"); 182 | XCTAssertEqualObjects([[NSColor hues_colorFromHex:@"#CCCCCCFFFFFF"] hues_hexWithLowercase:NO], @"#CCCCCC", @"hex with extra digits and # should return same hex"); 183 | XCTAssertEqualObjects([[NSColor hues_colorFromHex:@"#CCCCCFFFFFF"] hues_hexWithLowercase:NO], @"#CCCCCF", @"hex with extra digits and # should return same hex"); 184 | 185 | 186 | // test invalid input returns #000000 187 | XCTAssertEqualObjects([[NSColor hues_colorFromHex:@"ZZZZZZ"] hues_hexWithLowercase:NO], @"#000000", @"invalid should return #000000"); 188 | XCTAssertEqualObjects([[NSColor hues_colorFromHex:@"tyuytutytuytytuyt"] hues_hexWithLowercase:NO], @"#000000", @"invalid should return #000000"); 189 | XCTAssertEqualObjects([[NSColor hues_colorFromHex:@";^&> 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /tests/HuesTests-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'HuesTests' target in the 'HuesTests' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /tests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | --------------------------------------------------------------------------------