TechTalk: Colorized Commands

CL
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

These days, virtually everyone knows how to add hex codes in their source code to add color to their source. Examples of hex characters that may be used are x'22' for white or high intensity and x'38' for pink. This same technique works to add color to command prompts.

While creating the source for your command, place a hex character as the first byte of the PROMPT parameter. After compiling the command, you will have colored prompt text within your command. The sample code in 9 shows where to place the hex code (indicated by an x) to colorize your command. Warning: after you enter the hex code in the source, don't prompt on that statement or the entire contents within the prompt parameter will be converted to hex.

While creating the source for your command, place a hex character as the first byte of the PROMPT parameter. After compiling the command, you will have colored prompt text within your command. The sample code in Figure 9 shows where to place the hex code (indicated by an x) to colorize your command. Warning: after you enter the hex code in the source, don't prompt on that statement or the entire contents within the prompt parameter will be converted to hex.

- Todd Fisher


TechTalk: Colorized Commands

Figure 9: Colored Command Source

 CMD PROMPT('x Command Title') PARM KWD(FLD) TYPE(*CHAR) LEN(10) + PROMPT('x Input parameter') 
BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$0.00 Raised:
$