Customizing text colors and styles

The colors and visual styles used by aptitude to display text can be extensively customized. Each visual element has an associated “style”, which describes the particular colors and visual attributes that will be used to display that element. Styles take the form of a list of color and attribute settings. This list is not necessarily exhaustive; if some colors or attributes are not explicitly specified, their values will be taken from the surrounding visual context. In fact, most visual elements have an “empty” style by default.

You can change the contents of a style by creating a configuration group of the same name in the apt or aptitude configuration file. For instance, the “MenuBorder” style is used to draw the visual border around drop-down menus. By default, this border is drawn bold and white-on-blue. Placing the following text in the configuration file would change it to white-on-cyan:

Aptitude::UI::Styles {
  MenuBorder {fg white; bg cyan; set bold;};
};

As you can see, a style's configuration group consists of a sequence of instructions. The general classes of instructions are:

fg color

Sets the text foreground to the given color. See below for a list of the colors known to aptitude.

bg color

Sets the text background to the given color. See below for a list of the colors known to aptitude.

set attribute

Enables the given text attribute. See below for a list of the text attributes known to aptitude.

clear attribute

Disables the given text attribute. See below for a list of the text attributes known to aptitude.

flip attribute

Toggles the given text attribute: if it is enabled in the surrounding element, it will be disabled, and vice versa. See below for a list of the text attributes known to aptitude.

The colors that aptitude recognizes are black, blue, cyan, green, magenta, red, white, and yellow [17]. In addition, you may specify default in place of a background color to use the default terminal background (this could be the default color, an image file, or even “transparent”). The styles that aptitude recognizes are:

blink

Enables blinking text.

bold

Makes the foreground color of the text (or the background if reverse video is enabled) brighter.

dim

May cause text to be extra-dim on some terminals. No effect has been observed on common Linux terminals.

reverse

Swaps the foreground and background colors. Many visual elements flip this attribute to perform common highlighting tasks.

standout

This enables “the best highlighting mode of the terminal”. In xterms it is similar, but not idential to, reverse video; behavior on other terminals may vary.

underline

Enables underlined text.

You can select several attributes at once by separating them with commas; for instance, set bold,standout;.

[Note]Note

As hinted at above, the interpretation of both styles and text attributes is highly terminal-dependent. You may need to experiment a bit to find out exactly what some settings do on your terminal.

The following styles can be customized in aptitude:

Figure 2.12. Customizable styles in aptitude

StyleDefaultDescription
Bulletfg yellow; set bold; The style of the bullets in bulleted lists.
ChangelogNewerVersionset bold; The style of newer versions of the package in the changelog view. Note that aptitude will only highlight newer versions of the package if you have the package libparse-debianchangelog-perl installed.
Defaultfg white; bg black; The basic style of the screen.
DepBrokenfg black; bg red; The style of unfulfilled dependencies.
DisabledMenuEntryfg black; bg blue; set dim; The style of menu entries that are disabled and cannot be used.
DownloadHitfg black; bg green; The style used to indicate that a file was “hit”: i.e., it has not changed since the last time it was downloaded.
DownloadProgressfg blue; bg yellow; The style of the progress indicator for a download.
EditLinefg white; bg black; clear reverse; The style of line editors (for instance, the entry in the “Search” dialog).
Errorfg white; bg red; set bold;The style of error messages.
Headerfg white; bg blue; set bold; The style of screen headers.
HighlightedMenuBarfg white; bg blue; set bold,reverse; The style of the currently selected menu name in the menu bar.
HighlightedMenuEntryfg white; bg blue; set bold,reverse; The style of the currently selected choice in a menu.
MediaChangefg yellow; bg red; set bold; The style of the dialog used to ask the user to insert a new CD.
MenuBarfg white; bg blue; set bold; The style of the menu bar.
MenuBorderfg white; bg blue; set bold; The style of the borders that surround a drop-down menu.
MenuEntryfg white; bg blue; The style of each entry in a drop-down menu.
MineBombfg red; set bold; The style of bombs in Minesweeper.
MineBorderset bold; The style of the border drawn around a Minesweeper board.
MineFlagfg red; set bold; The style of flags in Minesweeper.
MineNumberNVarious The style of the number N in Minesweeper; N may range from 0 to 8.
MultiplexTabfg white; bg blue; The color used to display “tabs” other than the currently selected one.
MultiplexTabHighlightedfg blue; bg white; The color used to display the currently selected “tab”.
PkgBrokenfg red; flip reverse; The style of packages in the package list which have unfulfilled dependencies.
PkgBrokenHighlightedfg red; The style of highlighted packages in the package list which have unfulfilled dependencies.
PkgNotInstalled  The style of packages which are not currently installed and will not be installed.
PkgNotInstalledHighlighted  The style of highlighted packages which are not currently installed and will not be installed.
PkgIsInstalledset bold; The style of packages which are currently installed and for which no actions are scheduled.
PkgIsInstalledHighlightedset bold; flip reverse; The style of highlighted packages which are currently installed and for which no actions are scheduled.
PkgToDowngradeset bold; The style of packages in the package list which will be downgraded.
PkgToDowngradeHighlightedset bold; flip reverse The style of highlighted packages in the package list which will be downgraded.
PkgToHoldfg white; flip reverse; The style of packages in the package list which are on hold.
PkgToHoldHighlightedfg white; The style of highlighted packages in the package list which are on hold.
PkgToInstallfg green; flip reverse; The style of packages in the package list which are being installed (not upgraded) or reinstalled.
PkgToInstallHighlightedfg green; The style of highlighted packages in the package list which are being installed (not upgraded) or reinstalled.
PkgToRemovefg magenta; flip reverse; The style of packages in the package list which will be removed or purged.
PkgToRemoveHighlightedfg magenta; The style of highlighted packages in the package list which will be removed or purged.
PkgToUpgradefg cyan; flip reverse; The style of packages in the package list which will be upgraded.
PkgToUpgradeHighlightedfg cyan; The style of highlighted packages in the package list which will be upgraded.
Progressfg blue; bg yellow; The style of progress indicators such as the one that appears while the package cache is being loaded.
SolutionActionApprovedbg green; The style of approved actions in a solution.
SolutionActionRejectedbg red; The style of rejected actions in a solution.
Statusfg white; bg blue; set bold; The style of status lines at the bottom of the screen.
TreeBackground  The basic color of all visual lists and trees.
TrustWarningfg red; bg black; set bold; The color used to display warnings about package trust.



[17] On some terminals, a “yellow” background will actually come out brown.