DeepIT/XcodeColors — pull request #1 by robbiehanson (2012-05-24 09:55:32+00:00)
Title: Fixing xcode project & install script. And adding support for full color spectrum.

Great work! Really cool project!

After forking it, I fixed the Xcode project so it would compile with Xcode 4. Then I fixed the install script (Xcode 4 puts the build directory in a different place).

After that I started using it and thought it was great. But then I started wondering... why limit the project to only 16 colors?

Digging around in the source code I discovered that you're passing colors into NSTextStorage. So I realized that, conceptually, the project could support virtually any color. Just so long as it could parse the color information coming in.

Now I realize that the original project was meant to be compatible with the ANSI escape codes. The basic 16 colors. However the Terminal.app in Lion uses xterm-256color. I debated updating the project to support the 256 colors, but I still felt like this limited the potential of the project.

Ultimately I felt like the best solution would be to allow the user to specify any color they want using RGB values. If they run the application within Xcode, then XcodeColors will honor the color exactly as requested. However, if the user runs the application from within the terminal, then the application should automatically map the requested color to the closest available color the shell supports.

But obviously XcodeColors can't help outside of Xcode. Thus the above solution requires code outside of the actual XcodeColors plugin.

What I've done is update XcodeColors to support the entire color spectrum. It uses the same escape sequence as before, but then parses RGB values afterwards (including a foreground vs background color indicator). It works like a charm!

In addition, I've added native support for XcodeColors to the CocoaLumberjack framework:
https://github.com/robbiehanson/CocoaLumberjack

I wrote a blog post about it too:
http://deusty.blogspot.com/2012/05/does-your-xcode-do-this.html

Additionally, the code within Lumberjack automatically provides the color mapping as outlined above. That is, if you run your application from within a terminal, and your terminal supports color (xterm-color or xterm-256color) like the Terminal.app in Lion, then Lumberjack automatically maps your color customizations to the closest available color supported by the shell.