Home Page (Text Editor) | Overview | How Do I ... Topics | FAQ | Reference
Syntax coloring uses different colors for various elements of your code, such as keywords or comments. This coloring gives you visual cues about the structure and state of your code.
Set syntax coloring for one source file
Change colors used for syntax coloring
Set syntax coloring for user-defined keywords
Set syntax coloring for extensionless header files
Set syntax coloring for a custom HTML variation
To set syntax coloring for one source file
If there are multiple windows open on the same source file, select one. Syntax coloring changes will appear in all windows.
The Source File Properties page appears. The Language box displays the current language setting for syntax coloring. The drop-down list contains the available language choices.
The choice you made takes effect.
Tip If you create or save a file with a recognized extension (such as VBS, CPP, or HTM), syntax coloring for the language indicated by that extension takes effect immediately.
To change colors used for syntax coloring
The Font box displays the different fonts installed on your system. The text sample in the sample box changes to the font you select.
The Size box displays the sizes available for the selected font. The text sample in the sample box changes to the size you select.
The Background and Foreground boxes display the 16 standard colors and the Automatic setting. The text sample displayed in the Sample box changes to the color you select.
The behavior of the Automatic setting depends on the element selected. For colors that map to standard system elements (such as Foreground Color, Background Color, or Selected Text Color), the Automatic setting sets the element to the appropriate system color. For syntax coloring elements and other non-system defined colors, the Automatic setting indicates that the foreground color or background color from the same category is to be used.
To set syntax coloring for user-defined keywords
Note The usertype.dat file is read during initialization. It cannot be renamed, nor can it be reloaded during an editing session. The syntax coloring mechanism checks the usertype.dat file last. Thus, all previously defined color settings take precedence over the user-defined keywords.
For more information, see To change colors used in syntax coloring.
Tip For any source file, you can use the Source File Properties page to specify which language syntax coloring to apply (or turn off syntax coloring altogether). For more information, see Setting Font Style, Size, and Color.
To set syntax coloring for extensionless header files
Note The langext.dat file pairs filenames with a language. This file is consulted only when extension matching fails. That is, an HTML file is always identified as HTML, not as C/C++, even if it is listed in the C/C++ section of langext.dat.
To set syntax coloring for a custom HTML variation
The first line of the file is a signature that uniquely identifies the type of the file. It contains the name of the variation that will be displayed on the Source File Properties page. After the signature line, the format resembles that of a Windows initialization file. A semicolon at the beginning of a line indicates a comment.
Each section contains a list of names separated by spaces, carriage returns, or line feeds. The names do not need to be in alphabetical order. You must specify all the elements, attributes, and entities you want to color.
See the example for a general outline of a sample .hlx file.
Note If the custom variation you specify in the .hlx file has the same name as a built-in HTML support, it will override the built-in HTML support. There is a 14-character limit to the name of the HTML variation you specify.
The following example gives the general outline of an .hlx file. For brevity, this example is shortened to omit most names.
@HLX@ "HTML - Custom"
; Custom HTML tagset file.
; Must begin with the "@HLX@" signature and
; the name of the HTML variant in quotes. The
; name is limited to 14 characters.
;--------------------------------
[Elements]
; Element set, case-insensitive
; HTML tags, e.g. <H1>
A APPLET
; break control
BR NOBR WBR
; headings
H1 H2 H3 H4 H5 H6
; character formatting
B CITE CODE EM I KBD STRIKE STRONG TT U VAR
FONT S SUB SUP SMALL BIG BLINK DFN
; etc. ...
;--------------------------------
[Attributes]
; Attribute set, case-insensitive
; (applied to all elements)
ACTION ALIGN ALINK ALT
; etc. ...
;--------------------------------
[Entities]
; Entity set, case-sensitive
; special characters, e.g. &
; If this section is empty or omitted, the standard set from RFC1866 is used.
gt lt amp quot
; etc. ...