I'm quite sorry to tell you guys, but at this time, i cannot afford the time in keeping up this Project as it should be.
The Categories inside may still be worth taken a look, but I can not recommend using them in any production system.
But the development of the Lumumba framework hasn't been completely abandoned. I'm just focusing on the Mobile part, so have a look at https://github.com/Tharabas/lumobile for the iOS version of this framework.
-- Ben, December 2012
Lumumba contains a disjoint set of features
Especially the color classes needed an easy access point.
The THWebNamedColors
caches a map of named colors with the default web names (css) of the colors.
Thus you can grab an NSColor with the value of skyblue via [NSColor colorWithName:@"skyblue"]
A more generic parser version of this is [NSColor colorFromString:colorString]
wich tries to parse
any string into a NSColor.
That string2color parser allows even more stuff, like blending colors:
50% white, 50% blue -> [NSColor colorFromString:@"white <> blue"]
(see NSColor+Conversion for more details on this)
It even defines a (readonly) property colorValue on a NSString, allowing you to use this:
NSColor *magenta = @"magenta".colorValue;
NSColor *pinkGlass = @"pink".colorValue.translucent;
As well as another (readonly) property colorValues on NSArray
NSArray *colors = [NSArray arrayWithObjects:[NSColor blackColor],
[NSColor colorNamed:@"pink"],
[NSColor colorNamed:@"gold"],
nil
];
// or simply
NSArray *colors = @"black pink gold".words.colorValues;
Lots and lots of times, you usually need to format NSStrings.
Each time with [NSString stringWithFormat:format, arg1, arg2, arg3, ...]
This can be shortened to $(format, arg1, arg2, arg3, ...)
using the $
macro.
As well as [NSArray arrayWithObjects:o1, o2, o3, ..., nil]
May be written as $array(o1,o2,o3)
There are other preprocessor macros that do similar things.
Look for THPoint
, THSize
, THRect
in the sources.
... more details on that later ...
... more details on that later ...
All those components, snippets and code fragments have been created, because I either used them very often and thought, there should be an easier way to do this, or because I simply did not know that there is another way to do this in Objective-C.
I do neither claim all things to be flawless nor perfect to fit your Apps.
I'm absolutely aware, that preprocessor macros may be considered evil, as they obscure code. That may be right, but they can also be used to considerably clean up the code, what would be desired behaviour.
Anyway they are a feature of the c environment.
You may use it or you may leave it. Still your decision.
Constructive comments are welcome, anytime, though.