Skip to content

Commit 8a7f3fb

Browse files
committed
Fix for Adobe Kuler ASE files which come with no name for the colors (will use #RRGGBB name)
1 parent 7fda741 commit 8a7f3fb

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

Ase2Clr/RPCAdobeSwatchExchange.m

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,16 @@ - (void) readBlock:(NSFileHandle *) aseFileHandle {
8585
color = [NSColor colorWithWhite:grey alpha:1.0];
8686
}
8787
UInt16 type = [[aseFileHandle readDataOfLength:2] bigEndianUInt16];
88+
if (name == nil || [name isEqualToString:@"\0"]) {
89+
NSColor *convertedColor=[color colorUsingColorSpaceName:NSCalibratedRGBColorSpace];
90+
91+
NSString* hexString = [NSString stringWithFormat:@"#%02X%02X%02X",
92+
(int) (convertedColor.redComponent * 0xFF), (int) (convertedColor.greenComponent * 0xFF),
93+
(int) (convertedColor.blueComponent * 0xFF)];
94+
name = hexString;
95+
}
96+
97+
8898
self.colorNames = [self.colorNames arrayByAddingObject:name];
8999
self.colorList = [self.colorList arrayByAddingObject:color];
90100
if (self.colors)
@@ -99,4 +109,12 @@ - (void) readBlock:(NSFileHandle *) aseFileHandle {
99109
- (BOOL) writeToFile:(NSString *)path {
100110
return NO;
101111
}
112+
113+
- (void)finalize {
114+
self.colors = nil;
115+
self.colorNames = nil;
116+
self.colorGroups = nil;
117+
self.colorList = nil;
118+
[super finalize];
119+
}
102120
@end

SwatchInstall/RPCAppDelegate.m

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,5 @@ @implementation RPCAppDelegate
1313
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
1414
{
1515
// Insert code here to initialize your application
16-
self.window = self;
1716
}
18-
1917
@end

0 commit comments

Comments
 (0)