Set background color for selected text in TextEdit

A lot of people overlook TextEdit’s abilities as a word processor—in rich text mode, it’s actually not a bad tool for most word processing tasks. There is, however, one apparent omission: no way to create a colored background behind selected bits of text. Using the Fonts panel (Command-T), you can set a background color for the entire document, but you can’t apparently do something like this:

image
TextEdit with selected text blocks in differing background colors

So how then did I actually do that? With a little help from Mac OS X Hints contributors Michel Scriban and toc-rox, that’s how. These tipsters figured out how to create background color styles in TextEdit, which you can then apply to any text selection.

To start, you’ll need this file (5KB), which is a rich text file (RTF) containing a wide variety of colored backgrounds. Expand the archive, then drag and drop the resulting file (background colors.html) onto TextEdit. It should open and process the RTF commands in the file, resulting in a document that looks like this:

image
The master file of background colors

Depending on how TextEdit is set up, you might not see colors. If you see odd programming-like text instead of colors, open TextEdit’s Preferences, click on the Open and Save tab, and make sure that the “Ignore rich text commands in RTF files” option is not checked. This file is the master file from which you’ll create the background color styles you’d like to use.

Scan through the lines until you find a background color you’d like to use, then select any of the colored text on that line. Select Format -> Font -> Styles from the menu, and click Add to Favorites. This will display a small dialog box where you can name your style, and optionally include the font and/or the ruler as part of the style—don’t do this; you just want the background color, so it won’t change the style of whatever text you apply it to.

For a name, I suggest using a command prefix, such as bg- or bkgnd-, followed by the color name. This will make it easy to spot your background styles. After typing a name, click Add, and you’re done. Repeat this process with any of the other background colors you’d like to use on a regular basis.

Once created, you can apply your background color very easily. Select the text to be modified, click the Styles drop-down menu, and select the desired background color from the list. If you’d like to add additional colors to the file, you can do that, too, but it’s best to start with an HTML file, as it’s much easier to edit. (I converted it to an RTF because it then retains the tab markers, making it much easier to read.) If you’re interested in editing the HTML file, you can find it, and read some basic how-to instructions, in this hint on MacOSXHints.com.

Subscribe to the Help Desk Newsletter

Comments