title: Get #define of type UIColor from NSString
body: <p>I have defined the following constants, each of which represents a UIColor:</p>
  
  <pre><code>// Purple
  #define PURPLE_COLOR_DARK  [UIColor colorWithRed: 0.42 green: 0.25 blue: 0.60 alpha: 1.0]
  #define PURPLE_COLOR_LIGHT [UIColor colorWithRed: 0.78 green: 0.47 blue: 0.72 alpha: 1.0]
  
  // Blue
  #define BLUE_COLOR_DARK  [UIColor colorWithRed: 0.00 green: 0.46 blue: 0.70 alpha: 1.0]
  #define BLUE_COLOR_LIGHT [UIColor colorWithRed: 0.00 green: 0.75 blue: 0.88 alpha: 1.0]
  
  // Magenta
  #define MAGENTA_COLOR_DARK  [UIColor colorWithRed: 0.75 green: 0.00 blue: 0.28 alpha: 1.0]
  #define MAGENTA_COLOR_LIGHT [UIColor colorWithRed: 1.00 green: 0.32 blue: 0.61 alpha: 1.0]
  </code></pre>
  
  <p><strong>Question</strong></p>
  
  <p>How can I use an <code>NSString</code> like <code>@"purple"</code>, <code>@"blue"</code> or <code>@"magenta"</code> to get the related "X_COLOR_DARK" or "X_COLOR_LIGHT" constant? Is it even possible to do so directly?</p>
  
  <p><strong>Example</strong></p>
  
  <p>This is wrong, but should provide a clearer picture of what I'm asking. In this example, I have the string <code>@"blue"</code> and want to derive the <code>BLUE_COLOR_DARK</code> and <code>BLUE_COLOR_LIGHT</code> color values.</p>
  
  <pre><code>NSString *color = @"blue";
  UIColor *darkColor = (UIColor *)[[NSString stringWithFormat: @"%@_COLOR_DARK", color] uppercaseString];
  
  // Debugging    
  NSLog(@"%@", darkColor); // BLUE_COLOR_DARK
  NSLog(@"%hhd", [lightColor isKindOfClass: [UIColor class]]);  // 0
  NSLog(@"%hhd", [lightColor isKindOfClass: [NSString class]]); // 1
  </code></pre>
  
  <p><strong>Follow-Up</strong></p>
  
  <p>Note that UIColor is not necessarily relevant to answering the question, though it does help for my situation. More specifically, I'm asking if a string matching a defined name (e.g. <code>@"PURPLE_COLOR_DARK"</code> and <code>#define PURPLE_COLOR_DARK</code>) can be interpreted as the defined name instead of using the defined name directly.</p>