Brighten the default blue in Terminal.app

Mar 26, '02 12:23:14AM

Contributed by: Anonymous

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 Terminal.app...

[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.


Old:

0x1708c:        lfs     f1,21788(r9)		0xc029551c
0x17098: lfs f2,21788(r9) 0xc049551c
0x170a8: fmr f3,f31 0xfc60f890
0x170b4: lfs f4,21784(r9) 0xc0895518
New:
0x1708c:        lfs     f4,21784(r9)		0xc0895518
0x17098: fsubs f1,f4,f31 0xec24f828
0x170a8: fmr f2,f1 0xfc400890
0x170b4: fmr f3,f4 0xfc602090
Context:
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
Hex:
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
Old:
0x173bc:        lfs     f1,21788(r9)		0xc029551c
0x173c8: lfs f2,21788(r9) 0xc049551c
0x173d8: fmr f3,f31 0xfc60f890
0x173e4: lfs f4,21784(r9) 0xc0895518
New:
0x173bc:        lfs     f4,21784(r9)		0xc0895518
0x173c8: fsubs f1,f4,f31 0xec24f828
0x173d8: fmr f2,f1 0xfc400890
0x173e4: fmr f3,f4 0xfc602090
Context:
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)
Hex:
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

Comments (12)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20020326002314989