Hacker News new | ask | show | jobs
by bennyg 4640 days ago
I wrote a utility class with idiomatic Obj-C color methods like the one you mentioned and more. I hate to plug it, but I'm fairly proud of it. It also generates color schemes when you throw a UIColor object at it, and includes 100 different UIColor generics like [UIColor seafoamColor].

https://github.com/bennyguitar/Colours-for-iOS

2 comments

Why on Earth would you hate to plug this? I could definitely see someone using this and being thankful they don't have to do it themselves. Hell, I'd use it if I hadn't already done my own category.

Suggestions: you might want to allow for three-digit hex strings and eight/four digit hex strings with alpha, I found that convenient in mine. And in the documentation it would be way cool if you made the names of the colors self-referential.

Nits: I would have made all the system color methods like "systemThingColor", capitalized RGB and HSB, and made "RGBDictionary" return @{@"red": ...} (and made static NSStrings for the keys so nobody needs to go to the .m file to see what will happen). Obviously I am a pedant and I live right on the edge of the 80 character limit; of these I'd only suggest making static dictionary keys as an actually desirable change.

Nice work, you shouldn't be ashamed to share it at all.

looks really nice, looking forward to using it!