BBColors

BBColors is a free command-line tool for saving and loading text color preference schemes for BBEdit and TextWrangler.

Download

BBColors 1.0.1 (4 KB) — 15 October 2006

Installation

Copy “bbcolors” to some location in your shell’s PATH; a typical location would be /usr/local/bin/ or /usr/bin/.

bbcolors is a hack that works by diddling with BBEdit’s preferences; as such, I strongly recommend that you make a backup of your com.barebones.bbedit.plist file in your Preferences folder before using it.

Usage

To save your current BBEdit text color preferences to a set named “My Great Colors”, type:

bbcolors -save "My Great Colors"

To load the text colors from the set named “My Other Great Colors”, replacing your current BBEdit text color preferences, but leaving all of your other BBEdit preferences alone, type:

bbcolors -load "My Other Great Colors"

To use bbcolors with TextWrangler, add the -tw switch to the command line:

bbcolors -save "My TextWrangler Colors" -tw
bbcolors -load "My Other Great Colors" -tw

Because bbcolors does its thing by diddling with BBEdit’s preferences using the defaults system, colors can only be loaded when BBEdit (or TextWrangler) is not running. Colors may be saved at any time, however.

For the full manual, type:

bbcolors -man

from the command line. There are a bunch of other options and commands.

Color Scheme Files

Color schemes are saved as text files in ~/Library/Application Support/BBColors/, using the file name extension “.bbcolors”. So, a color scheme named “My Great Colors” will be saved as a text file at:

~/Library/Application Support/BBColors/My Great Colors.bbcolors

These files can be shared with others. To “install” a color set file, simply copy it to your ~/Library/Application Support/BBColors/ folder.

To open this folder in the Finder (and create it if it doesn’t exist), type:

bbcolors -open

To open this folder in a disk browser window in BBEdit:

bbcolors -bbopen

To open this folder in a disk browser window in TextWrangler:

bbcolors -bbopen -tw

To list all currently installed color schemes:

bbcolors -list

Color Scheme File Format

Lines starting with “//” (two slashes) are treated as comments. This is useful for adding your name and other information to files you intend to share with others. Comments are only supported at the beginning of lines.

Settings are stored in the form:

"key" = "value";

Lines must end with a semi-colon. Numeric values should not be quoted. For example:

"Color:ColorAttributesSeparately"  =  1; 
"Color:Comment"                    = "rgb(52428,35980,15420)"; 

Backslashes and double-quotes in the name of a key (or value, in theory, but none of these keys should have values that contain either of these characters) must be escaped with a backslash.

BBColors scheme files are encoded as UTF-8; no other encoding is supported.

I’ve created a simple codeless language module for BBColors color scheme files: BBColors_Scheme_CLM.zip. This language module will only work in BBEdit 8.5 and later.