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

Change the colors for BBEdit's Invisibles feature Apps
I just posted this on my blog, and I thought it might be useful here too.

While I find BBEdit to be a fantastic text editor, there are a few minor things I've always wanted to change, one of which is the color for Invisibles. I love the idea, but against my preferred background color, they stand out far too much to be anything but distracting.

If you've never seen Invisibles, you can enable them for the current document in the Text Options menu of that window's toolbar, or globally by going to Preferences » Editor Defaults » Show Invisibles.

Now, if at first glance they seem obnoxious, imagine their color changed to be a bit more subtle, like just slightly darker or lighter than the background color. Sound better? Read on!

First of all, I recommend that you back up the ~/Library » Preferences » com.barebones.bbedit.plist prefs file, just in case. Then open a new Terminal window and paste this line in (and leave the window open afterwards):
export BBEDIT_COLOR=$(defaults read com.barebones.bbedit Color:Comment)
In BBEdit, go to Preferences Text Colors, and change the color for Comment to the color you'd like for Invisibles (feel free to actually throw some code and comments into a page to test with), then quit BBEdit.

In the same shell as before. run these commands:
$ defaults write com.barebones.bbedit Color:Invisibles:Spaces -string "$(defaults read com.barebones.bbedit Color:Comment)"
$ defaults write com.barebones.bbedit Color:Invisibles:Other -string "$(defaults read com.barebones.bbedit Color:Comment)"
$ defaults write com.barebones.bbedit Color:Comment -string "$BBEDIT_COLOR"
Open BBEdit, and you're done. You can close the shell now if you'd like. Notes:
  • If "Reopen documents that were open at last quit" is enabled, when BBEdit opens, the first document apparently uses the default Invisibles colors (even if they are changed in BBEdit's DefaultPreferences.plist file). I have found no way around this annoyance, short of always opening an empty placeholder text file as the first open file in that window.
  • Color:Invisibles:Other doesn't actually seem to change anything, not that I've noticed at least.. but I'm setting it anyways, just in case.
If you think Bare Bones should include proper configuration for Invisibles colors, let them know!

[robg adds: I haven't tested this one.]
    •    
  • Currently 1.75 / 5
  You rated: 4 / 5 (8 votes cast)
 
[7,202 views]  

Change the colors for BBEdit's Invisibles feature | 1 comments | Create New Account
Click here to return to the 'Change the colors for BBEdit's Invisibles feature' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Change the colors for BBEdit's Invisibles feature
Authored by: MJCube on Jun 13, '09 12:01:13PM
Nice find! This also works with TextWrangler. To me the method in the hint, saving a variable and setting a color to it, seemed abstruse, so I did it a more hands-on way. It's as simple as one command line, replacing x,y,z with your preferred color in 16-bit RGB:

defaults write com.barebones.textwrangler Color:Invisibles:Spaces -string "rgb(x,y,z)"

I discovered that Color:Invisibles:Other is for control characters and other "gremlins" which show in red (¿) by default, and Color:Invisibles:Spaces is for all the others: space (â—Š) tab (∆) CR (¬) non-breaking space (•) and page break (¶). I left my gremlins as is; the default is rgb(56797,2056,1542).

One way to get 16-bit RGB values (0~65535) is by mousing over the color with Digital Color Meter. If you like your current comment color, you can get its value with
defaults read com.barebones.textwrangler Color:Comment
or just open ~/Library/Preferences/com.barebones.textwrangler.plist and find the value under Color:Comment. I personally like comments in a light grey and invisibles in an even lighter grey.

You can edit .plist files directly in TextWrangler, but if you edit its own plist and delete a key such as Color:Invisibles:Other, it still remembers the value and rewrites it on quitting. So you have to quit TW first, then execute defaults delete com.barebones.textwrangler Color:Invisibles:Other (or use a different text editor).

((Now if only I could find how to hack TW to show a different character for spaces. The diamond ◊ is "noisy" as the User Guide says, and I would much prefer a centered dot (·). I hacked QUED/M to do this ages ago, but haven't found how to do it to TW.))

[ Reply to This | # ]