Leopard Terminal.app colors


Back in OS X 10.4 (Tiger) you used to be able to change text colors using a really unintuitive yet workable bit of UI. You would open a color dialog from any non-Terminal app, select the color you wanted, then drag that color to some existing bit of colored text that you wanted to be the new color in the future. I’m not a fan of this, but at least it’s one of these one-time things that you don’t do again until you get a new computer or have to reinstall the OS for some reason.

When I upgraded to 10.5 (Leopard) some time back I found that this trick for setting the colors didn’t work anymore. Instead they had added color settings profiles. When I first saw it I thought that they had rectified the UI deficiencies in Tiger’s terminal, and they did, in one sense. You now had the choice of a few different color profiles with color choices that don’t seem so bad at first glance. However, once I played around with it for a few minutes I realized that there was no way to change any of the colors besides the foreground, background, cursor, and selection. So the terribly dark blue on black that showed up whenever something in my terminal sent ANSI escape codes for blue couldn’t be fixed.

It looks like the engineers at Apple were thinking about providing the right functionality and then got lazy or stupid at the last minute. They provided the ability to duplicate, delete, import, and export profile settings, which are all sensible features. You just can’t edit any of the ANSI color settings in the profiles in any way. If you export the profile to a file you get *awesome* bits of property list XML like this:

<key>TextColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGCQpYJHZlcnNpb25UJHRvcFkkYXJjaGl2ZXJYJG9iamVjdHMS
AAGGoNEHCFRyb290gAFfEA9OU0tleWVkQXJjaGl2ZXKjCwwTVSRudWxs0w0ODxARElYk
Y2xhc3NcTlNDb2xvclNwYWNlVU5TUkdCgAIQAUYxIDEgMQDSFBUWF1gkY2xhc3Nlc1ok
Y2xhc3NuYW1lohcYV05TQ29sb3JYTlNPYmplY3QIERofKTI3Oj9BU1ddZGt4foCCiY6X
oqWtAAAAAAAAAQEAAAAAAAAAGQAAAAAAAAAAAAAAAAAAALY=
</data>
...
<key>blueColour</key>
<data>
BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARm
ZmZmAIOBgAA/AQGG
</data>

(bonus points for arbitrarily switching back and forth between the American and British spellings of color/colour) Anyway, if you decode the MIME in the data tags you get the following:

# TextColor
% ./decode.pl  | xxd
0000000: 6270 6c69 7374 3030 d401 0203 0405 0609  bplist00........
0000010: 0a58 2476 6572 7369 6f6e 5424 746f 7059  .X$versionT$topY
0000020: 2461 7263 6869 7665 7258 246f 626a 6563  $archiverX$objec
0000030: 7473 1200 0186 a0d1 0708 5472 6f6f 7480  ts........Troot.
0000040: 015f 100f 4e53 4b65 7965 6441 7263 6869  ._..NSKeyedArchi
0000050: 7665 72a3 0b0c 1355 246e 756c 6cd3 0d0e  ver....U$null...
0000060: 0f10 1112 5624 636c 6173 735c 4e53 436f  ....V$class\NSCo
0000070: 6c6f 7253 7061 6365 554e 5352 4742 8002  lorSpaceUNSRGB..
0000080: 1001 4631 2031 2031 00d2 1415 1617 5824  ..F1 1 1......X$
0000090: 636c 6173 7365 735a 2463 6c61 7373 6e61  classesZ$classna
00000a0: 6d65 a217 1857 4e53 436f 6c6f 7258 4e53  me...WNSColorXNS
00000b0: 4f62 6a65 6374 0811 1a1f 2932 373a 3f41  Object....)27:?A
00000c0: 5357 5d64 6b78 7e80 8289 8e97 a2a5 ad00  SW]dkx~.........
00000d0: 0000 0000 0001 0100 0000 0000 0000 1900  ................
00000e0: 0000 0000 0000 0000 0000 0000 0000 b60a  ................
# blueColour
% ./decode.pl  | xxd
0000000: 040b 7374 7265 616d 7479 7065 6481 e803  ..streamtyped...
0000010: 8401 4084 8484 074e 5343 6f6c 6f72 0084  ..@....NSColor..
0000020: 8408 4e53 4f62 6a65 6374 0085 8401 6301  ..NSObject....c.
0000030: 8404 6666 6666 0083 8180 003f 0101 860a  ..ffff.....?....

To me that looks like they are serialized Objective-C objects of some sort. I haven’t played with this recently but I tried replacing one of the color data blocks with one of the other color data blocks, then import that profile, but nothing changed. Anyway, since I have no interest in learning Objective-C or Cocoa or any of those other crazy Mac-specific languages or APIs, this is where my attempts at lesser hackery stop.

So instead the best answer that I’ve managed to find so far is someone else’s hack. It strikes me as a pretty extreme way to do this, since it looks like InputManagers are the OS X GUI equivalent of an LD_PRELOAD hack as far as I can tell. Plus I recall reading somewhere that they are deprecated and will probably be removed at some point in the future.

I have no idea why Apple doesn’t want to spend a day or two of engineering time to fix this legitimately for all of the users out there who work in the Terminal day-in and day-out like me. Would a config file with some simple hex color codes really be so hard to implement? I’m not even asking for a real color picker dialog, I just want the ability to open something in vim (or at minimum, the Property List Editor app) and tweak my preferences. It just seems like another example of Apple ignoring serious OS and UI usability issues to me.