Partager via


Font and Color Overview

This topic discusses text font and color settings in the Visual Studio integrated development environment (IDE). It also introduces the concepts of Categories and Display Items, and it describes how VSPackages and the core editor use text attributes.

The Fonts and Colors Property Page

You can manage attributes of displayed text in the Visual Studio integrated development environment (IDE) through the Fonts and Colors property page. To find the Fonts and Colors property page, on the Tools menu, click Options. Expand Environment, and then click Fonts and Colors.

Categories and Display Items

Fonts and colors are organized into Categories and Display Items.

  • A Category is a logical or functional container for a number of Display Items.

    A list of Categories is in the Show settings for drop-down box of the Fonts and Colors property page.

  • A Display Item is a well-defined text entity such as a comment, a string, or a control structure that is to be colorized when displayed.

Each Display Item is uniquely defined within the Category that contains it. Consequently, more than one Category can have a Display Item with the same name.

VSPackage Control of Fonts and Colors

The Visual Studio SDK allows VSPackages to:

  • Define font and color Categories.

  • Specify the fonts and colors used to present Display Items.

  • Interact with the Fonts and Colors property page.

  • Aggregate multiple Categories into groups.

  • Persist changes in default settings.

There are two ways to interact with font and color selections within the Visual Studio SDK.

  • One way is referred to as Syntax Coloring. It is used by a VSPackage that customizes the existing Visual Studio editor to implement a language service and create a source editor.

    Only one Category supports this mechanism, namely, the Text Editor.

  • A more general alternative supports all other Categories and user interface components other than the source editor when displaying text. For more information, see IVsFontAndColorDefaultsProvider.

Core Editor Text Settings

Font and color settings for the core editor of a language service object are governed by the Text EditorCategory found in the Show settings for drop-down box of the Fonts and Colors property page.

When working with editors, you should use the specialized font and color control mechanism that the language service provides to control and extend the Text Editor settings. The mechanism is referred to as syntax coloring and provides:

For more information on syntax coloring see Syntax Coloring.

See Also

Concepts

Syntax Coloring

Other Resources

Accessing the Editor By Using Legacy Interfaces