engineer • Develop apps for iOS • Regulate “Auto Layout” day after day… :’-( • I’m interested in • Metal (new graphics API of Apple) • Functional programming (with Swift) • Reactive programming (Reactive Cocoa) Twitter: @yuseinishiyama GitHub: https://github.com/yuseinishiyama Blog: yuseinishiyama.com (not so active)
green:250.f/255.f blue:245.f/255.f alpha:1.f]; _someLabel.textColor = [UIColor colorWithRed:181.f/255.f green:177.f/255.f blue:169.f/255.f alpha:1.f]; It’s so hard to maintain.
U N I F I E D WAY @implementation UIColor (CookpadUIColors) ! + (UIColor *)cui_greenColor { return [self cui_greenColorWithAlpha:1.0]; } ! + (UIColor *)cui_greenColorWithAlpha: (CGFloat)alpha { return [self colorWithRed:0.545 green:0.678 blue:0.0 alpha:alpha]; }
P E R L I B R A RY “An NSColorList object is an ordered list of NSColor objects, …The NSColorPanel list mode color picker uses instances of NSColorList to represent any lists of colors that come with the system, as well as any lists created by the user. An application can use NSColorList to manage document-specific color lists.”
T E • Read from a file • Install a color list NSColorList *colorList = [[NSColorList alloc] initWithName:colorListName fromFile:self.inputURL.path]; [colorList writeToFile:nil];
[[inputURL lastPathComponent] stringByDeletingPathExtension]; NSColorList *colorList = [[NSColorList alloc] initWithName:colorListName fromFile:self.inputURL.path]; ! NSColor *hogeColor = [NSColor colorWithRed:0.5 green:0.5 blue:0.5 alpha:1]; ! [colorList insertColor:hogeColor key:@"HogeColor" atIndex:0]; [colorList writeToFile:nil]; E D I TA B L E
c - c o d e g e n u t i l s > • Generate codes from .crl files • https://github.com/square/objc-codegenutils/tree/ master/colordump • brew install objc-codegenutils