.scheme files

These define the fonts, colours, styles and keywords for languages that Programmer's Notepad (via Scintilla) has built-in support for. PN contains code that parses/lexes and understands a lot of languages already. These files surface and configure that support.

Scheme element

Document element for scheme.

Child elements:

style-classes element

Container element for style classes.

Child elements:

style-class element

Purpose unknown, probably defines style settings to be inherited by other style elements. A scheme can override predefined styles which can be found in master.scheme. All styles inherit the default style class, default style class inherits system defaults.


keyword-classes element

Container element for keyword classes.

Child elements:

keyword-class element

Defines named keyword group.


Child elements:

Text content:

include-class element

Adds a keyword class to this class.


base-language element

Defines language settings to be inherited by language elements.

language element

Defines language settings.


Child elements:

comments element

Defines comment delimiters. This doesn't affect how the lexer highlights comments, it only affects PN functions of commenting and uncommenting blocks of code.


lexer element

Assigns lexer for the language.


property element

Key-value pair for lexer property.


use-keywords element

Container element for keywords used by the language.

Child elements:

keyword element

Defines binding between keyword class and keyword list index.


use-styles element

Container element for styles used by the language.

Child elements:

style element

Defines style settings.


group element

Groups styles. Purpose unknown, probably defines common style settings for enclosed styles.


Child elements:

.schemedef files

These define the syntax for a language as well as the fonts, colours... The files are interpreted by a plugin for PN called customscheme.dll which provides code to tell PN how to interpret text according to the rules in the .schemedef. Scintilla built-in lexers (used by .scheme files) usually highlight text according to hardcoded syntax rules, customscheme lexer supports simple configuration of the language syntax.

key attribute

As PN scans the text in a file it assigns every character in the file a "style", represented by a key.
Unfortunately each different built-in language can and often does use the keys to mean different things. So in C++ style 5 is used for keywords whereas HTML uses style 5 for numbers. There is one definitive source of information mapping key numbers to meanings, and that's the .properties files shipped with the SciTE distribution - SciTE is the test editor developed alongside Scintilla.

One style number that is almost always unchanged is that 32 is the default text style - normally this means text with no specific meaning.

When using a .schemedef file, the style keys are fixed:


The limitation to keyword sets is defined by two hard limits: The first is that Scintilla supports a fixed maximum number of keyword sets, currently 8. The second is that each language lexer only uses the keyword sets that the author thought were necessary - this means that often a language will support only one or two sets of keywords. The .schemedef lexer supports 5 as when it was developed that was the Scintilla limit.

User Configuration and Caches

The changes a user makes to fonts and colours are not stored in the original .scheme or .schemedef files, the configuration of these things is instead stored in a file called UserSettings.xml in the per-user PN application data directory. Unless you're using the portable edition of PN, this will likely be here:

Vista: c:\users[your username]\AppData\Roaming\Echo Software\PN2

XP: c:\documents and settings[your username]\Application Data\Echo Software\PN2

The configuration in usersettings.xml is applied to the schemes you have installed, and the result is cached in a binary format in the .cscheme files you'll find in that directory.