We may now add some color and font specifications to the file: contrib/Exp/pprinters/basic/basic.rdb
!For variables *visual-color*formalism-Exp.Pprinter.Format.class-name.foreground: red *formalism-Exp.Pprinter.Format.class-name.font: \resbs -adobe-helvetica-*-r-*-*-14-100-*-*-*-82-*-* !For integers *visual-color*formalism-Exp.Pprinter.Format.class-number.foreground: RoyalBlue4 *formalism-Exp.Pprinter.Format.class-number.font : \resbs -adobe-new century schoolbook-bold-i-*-*-14-*-*-*-*-*-*-* !For comments *visual-color*formalism-Exp.Pprinter.Format.class-comment.background: misty rose !For anything else. *visual-color*formalism-Exp.Pprinter.Format.background: oldlace *visual-color*formalism-Exp.Pprinter.Format.foreground: black *formalism-Exp.Pprinter.Format.font: -*-lucida-medium-r-*-*-14-140-*-*-*-*-*-*
The first two specifications provide foreground and font values for the name class, the next two for the number class, and the last three specify the color and font of all other tokens (at the Format class level).
Notice that every resource pertains solely to the basic pretty printer. Resources common to all Exp pretty printers belong in the file: contrib/Exp/pprinters/pprinters.rdb
Since the basic.rdb database file is only loaded when we use the basic pretty printer, resources that by mistake concern other pretty printers will not be visible before using the basic pretty printer. We avoid this kind of unhealthy dependency through the pretty printer manager.
The sole comment class resource specifies a background color for the comment text.
Note the use of the Visual class, instance color, which means that these resources only apply when using a color console. If you have a gray scale (instance gray) or monochromatic console (instance mono), you may want to specify other resources. Consider the case of the current selection. When we use Centaur with a color console we may present the current selection in living color, otherwise we may use a reverse video effect. Consider these specifications:
*formalism-Exp.Pprinter.Format.Select.foreground: none *visual-color*formalism-Exp.Pprinter.Format.Select.Mode : transparent *visual-color*formalism-Exp.Pprinter.Format.Select.background:LightSkyBlue1 *visual-mono*formalism-Exp.Pprinter.Format.Select.Mode : reverse
The first specification indicates that the foreground color of selected tokens will be none, a special value meaning ``no value specified.'' Since we have not specified a foreground color, we may specify a Mode for the selection, indicating how to highlight the foreground of a selected token. The same principle applies to the selection background, but here we will only examine the foreground presentation. The value transparent means that the static token color will be used. Thus, numbers will appear in RoyalBlue4 and variables in red even when selected. However, we specify the selection background as LightSkyBlue1, so the tokens will be surrounded by light blue. Instead of transparent we could have chosen other modes described in the resource manual. The last specification means that using a monochrome console, the selection is displayed in reverse video.
Other than color and font resources, we may specify the default print level of a program, the width of a line, the distance between lines, etc.
*formalism-Exp.Pprinter.Format.vskip : 1 *formalism-Exp.Pprinter.width: 80 *formalism-Exp.Pprinter.printLevel: 10
To test these resources, click on and then reread a file or click on the button of an existing ctview containing an Exp program.
N.B. In the previous resources, we have used the class name Pprinter everywhere instead of the instance name pprinter-basic. We intend to work with the modular pretty printer std instead of basic directly. If the pretty printer's name is std, resources with the instance name basic will not be considered. Using the class name Pprinter (or the question mark) allows these resources to be visible for any Exp pretty printer, including std.