Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Brighten the default blue in Apps
I'm sure I'm not the only one who has switched to a black background Terminal window, with transparency. I'm also sure that I'm not the only one who has been annoyed by the default colour used for dark-blue; it's very hard to read text displayed in that colour (the blue used, for example, to show directory entries in a color 'ls' command).

However, I might actually be the only person who was annoyed enough to fix it. It wasn't easy since the colours used are clearly hardcoded. With a little help from my friends GDB and HexEdit, I can now easily read blue text.

What follows is *not* for the faint-of-heart. I wish there were an easier way, but I can't think of one. If what follows doesn't immediately make sense to you, you're probably better off just living with the Terminal the way it is.

Read the rest of the article for more on changing the color blue inside

[Editor's note: The following instructions are provided as received. They are far from step-by-step, and you should have a solid understanding of both GDB and HexEdit before proceeding. As that previous sentence does NOT describe me, I have not tried this hint! Proceed at your own risk...really, I mean it - this hint requires additional knowledge beyond what is provided here.]

All addresses are from GDB and reflect addresses once the binary is loaded. The actual offsets in the file are 0x10000 less. (So, offset 0x1708c below would be 0x1608c in the Terminal file.)

For the hardcore geeks out there: The code that follows is from what looks to be the -awakeFromNib method of a custom NSView subclass. By the time we get to offset 0x17078 f31 has been loaded with 0.8, 21788(r9) holds 0.0 and 21784(r9) holds 1.0. The objc_msg at the end of each block of disassembly is [NSColor colorWithCalibratedRed:green:blue:alpha]. The floating point colour components are passed in f1, f2, f3 and f4. The original code loaded zero into f1 and f2; 0.8 into f3; 1 into f4. I switched it to load 1 into f4 first, then put 1 in f3 and compute 0.2 to put in f1 and f2. This gives a brighter blue.

0x1708c:        lfs     f1,21788(r9)		0xc029551c
0x17098: lfs f2,21788(r9) 0xc049551c
0x170a8: fmr f3,f31 0xfc60f890
0x170b4: lfs f4,21784(r9) 0xc0895518
0x1708c:        lfs     f4,21784(r9)		0xc0895518
0x17098: fsubs f1,f4,f31 0xec24f828
0x170a8: fmr f2,f1 0xfc400890
0x170b4: fmr f3,f4 0xfc602090
0x17078:        stw     r3,148(r30)
0x1707c: lwz r3,0(r28)
0x17080: lwz r4,0(r27)
0x17084: li r5,0
0x17088: addis r9,r31,1
0x1708c: lfs f1,21788(r9)
0x17090: mr r6,r5
0x17094: addis r9,r31,1
0x17098: lfs f2,21788(r9)
0x1709c: fmr f0,f31
0x170a0: stfs f0,80(r1)
0x170a4: lwz r7,80(r1)
0x170a8: fmr f3,f31
0x170ac: lis r8,16256
0x170b0: addis r9,r31,1
0x170b4: lfs f4,21784(r9)
0x170b8: bl 0x2b3b8
0x17078:        0x907e0094
0x1707c: 0x807c0000
0x17080: 0x809b0000
0x17084: 0x38a00000
0x17088: 0x3d3f0001
0x1708c: 0xc029551c
0x17090: 0x7ca62b78
0x17094: 0x3d3f0001
0x17098: 0xc049551c
0x1709c: 0xfc00f890
0x170a0: 0xd0010050
0x170a4: 0x80e10050
0x170a8: 0xfc60f890
0x170ac: 0x3d003f80
0x170b0: 0x3d3f0001
0x170b4: 0xc0895518
0x170b8: 0x48014301
0x173bc:        lfs     f1,21788(r9)		0xc029551c
0x173c8: lfs f2,21788(r9) 0xc049551c
0x173d8: fmr f3,f31 0xfc60f890
0x173e4: lfs f4,21784(r9) 0xc0895518
0x173bc:        lfs     f4,21784(r9)		0xc0895518
0x173c8: fsubs f1,f4,f31 0xec24f828
0x173d8: fmr f2,f1 0xfc400890
0x173e4: fmr f3,f4 0xfc602090
0x173a8:        stw     r3,212(r30)
0x173ac: lwz r3,0(r29)
0x173b0: lwz r4,0(r27)
0x173b4: li r5,0
0x173b8: addis r9,r31,1
0x173bc: lfs f1,21788(r9)
0x173c0: mr r6,r5
0x173c4: addis r9,r31,1
0x173c8: lfs f2,21788(r9)
0x173cc: fmr f0,f31
0x173d0: stfs f0,80(r1)
0x173d4: lwz r7,80(r1)
0x173d8: fmr f3,f31
0x173dc: lis r8,16256
0x173e0: addis r9,r31,1
0x173e4: lfs f4,21784(r9)
0x173e8: bl 0x2b3b8
0x173ec: lwz r4,0(r28)
0x173a8:        0x907e00d4
0x173ac: 0x807d0000
0x173b0: 0x809b0000
0x173b4: 0x38a00000
0x173b8: 0x3d3f0001
0x173bc: 0xc029551c
0x173c0: 0x7ca62b78
0x173c4: 0x3d3f0001
0x173c8: 0xc049551c
0x173cc: 0xfc00f890
0x173d0: 0xd0010050
0x173d4: 0x80e10050
0x173d8: 0xfc60f890
0x173dc: 0x3d003f80
0x173e0: 0x3d3f0001
0x173e4: 0xc0895518
0x173e8: 0x48013fd1
0x173ec: 0x809c0000
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)

Brighten the default blue in | 12 comments | Create New Account
Click here to return to the 'Brighten the default blue in' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Authored by: monotoy on Mar 26, '02 05:57:26AM

hmmmm haven't tried this under osx yet, but (at least with bash) should be possible to modify over the $LS_COLORS environment variable.
type 'set' or 'echo $LS_COLORS' to check your values, and modify them accordingly.


[ Reply to This | # ]
Authored by: robg on Mar 26, '02 10:32:47AM

That was my initial take on it as well, but I figured perhaps someone out there might get something out of this much more low-level modification ;-).

Does the low-level hack accomplish anything you couldn't do with $LS_COLORS?


[ Reply to This | # ]
dumb & dangerous, man dircolors
Authored by: Anonymous on Mar 26, '02 03:14:00PM

I don't mean to sound like I'm flaming, but this is going to cause a lot of novice users grief, for something that's in the documentation.

I ask that when you submit tips, that you research thoroughly, especially when you're submitting hacks (don't get me wrong, hacks are cool).

Hex editing stuff is bad. Especially when the GNU ls documention plainly points to the dircolors stuff.

Just read the documentation (man ls & man dircolors, for those with the GNU ls installed).

RTFM, people.

Some links to check out:

[ Reply to This | # ]
Authored by: dete on Mar 26, '02 04:59:33PM

As the author of this hack I have a few words to say in my defense:

1 - I purposely submitted this hack with no step-by-step directions: I hoped to scare away anyone who wasn't very comfortable with hex-editing and/or PowerPC assembly language.

2 - This hack is *not* the same as changing the dir colours, or modifying the colour map for vim, or wherever else colours are defined.

You see, there are 8 basic colours command line tools can display: black, white, red, green, blue, cyan, yellow and magenta. However, the terminal program (in this case "Terminal") gets to decide what precise shade to use for those colours. By changing the dir colours, or other user-accessible preferences, the best you can do is tell all your software to never use the blue colour, leaving you with only 7 colours to pick from. I didn't want that!

So, I hacked Terminal to change its definition of "blue". It's only slightly brighter (0.2, 0.2, 1) vs. (0, 0, 0.8), but it allows me to use all 8 colours on my terminal (transparent black).

In deference to greygent: It *is* stupid, and it is dangerous. But I had fun tracking it down and I was pleased with the result. I hoped that at least one other "hacker" out there might appreciate the info, so I submitted it here.

I'd be interested in hearing if anyone else out there was crazy enough to try it...


[ Reply to This | # ]
Authored by: risc_abacus on Mar 26, '02 05:08:10PM

Could you please clarify one some tidbit for me... your using the GNU version of 'ls' from fileutils... and not the apple version of 'ls' correct? …. Since (from what I know) only the GNU file utilities version of ‘ls' has color…. Correct me if I'm wrong please.

[ Reply to This | # ]
Gnu ls
Authored by: dete on Mar 26, '02 05:23:42PM

Yup. I got GNU ls using Fink, but there are other sources (follow the links above)...

[ Reply to This | # ]
Authored by: phayd on Mar 27, '02 02:03:35AM

I guess I don't see the point. All you need to do is go Terminal->Preferences.

Guess what? The background color is an option in the "Text & Colors" screen.

Here is a step by step guide to changing colors...

1. Change the color in Terminal. Make sure to hit "apply"
2. Quit terminal
3. Change the transparency in TinkerTool.
4. Open Teminal to the baby-blue goodness(?) of your transparent terminal.

Now, on the other hand, if you tracked down the bugs in Entourage...

[ Reply to This | # ]
Authored by: phayd on Mar 27, '02 02:06:26AM

<me> Insert foot in mouth. </me>I see what you did, you changed the text color of dark blue, as your terminal screen is black.

[ Reply to This | # ]
At least one Bravo!
Authored by: james_sorenson on Mar 27, '02 04:00:05PM

Man, he sure is getting a lot of flak for his hint! I, for one, understand the value of this. IF you install the fileutils with Fink, and IF you enable colors in the ls command, THEN you will find that the blue colored text in the ls output is worthless on anything other than a white background. The blue text is too dark. Unfortunately, you can't specify RGB values or anything similar in the LS_COLOR variable. If you can't change the color assignment, then change how the terminal presents "blue." For us geeks who want the perfect system, this is a good hint. A bit daunting to implement, though. Nice work.

[ Reply to This | # ]
It worked, now let's improve it.
Authored by: Bishop on Mar 28, '02 10:19:10AM

I've tried it and it worked fine. One problem tough it didn't get as bright as I wanted, no real improvement. Would it not be possible to change the color to something like [0 1 1 1] to get a cyan color instead? I don't have all the stuff to figure out exactly how to change this, but shouldn't something like:

lfs f4,21784(r9)
fmr f3,f4
fmr f2,f3
fsubs f1,f2,f3

do this? Also would it not be nice if someone sat down and wrote a patch that did this "automaticly"?

[ Reply to This | # ]
It worked, now let's improve it.
Authored by: dete on Mar 29, '02 07:43:21PM

I don't know if going with cyan would really be an "improvement", if you just want cyan text, then you can simply remap the colours the way that greygent suggested.

It's true that the "lighter" blue that I was able to achieve is still a little darker that is ideal. In my testing I found (0.3, 0.3, 1) to be better, but I couldn't find a way to calculate 0.3 in just 4 instructions (you can't increase the number of instructions without breaking the whole application.)

I also thought that it would be nice to be able to work out different colours for bold vs. normal text. It turns out that Terminal stores two colour objects, one for bold text, one for normal text, but then initializes them to the same value. You could use slightly different shades to indicate bold colours...

As for building a patch tool, I would only consider it if I could figure out a way to specify all colours explicitly. Anything less is just "much ado about nothing"... (Plus the patch would only work on one version of


[ Reply to This | # ]
Change any ANSI color in
Authored by: weaponx on Jun 25, '03 06:28:41AM

I just finished a hack that adds a full color picker for all the ANSI colors in the It solves this problem and lets you arbitrarily set any of the colors in the prefs file, or a .term file.

[ Reply to This | # ]