Home
Developer Resources
QNX RTOS v4
QNX RTOS v4 Knowledge Base

QNX RTOS v4 Knowledge Base

Foundry27
Foundry27
QNX RTOS v4 project
Resources

QNX RTOS v4 Knowledge Base

Title Changing Pterm colors
Ref. No. QNX.000009798
Category(ies) Development
Issue Is there a way to change the Pterm colors? We would like to have a white background with black letters, in order to save ink on the printer.




Solution You can change pterm's palette file. Make sure that you do not use the same value for two different entries-this way, even if some text is not readable, you will be able to tell that it is a text and not just a blank space.

Instead of changing the contents of your palette, it is possible to pick different entries from the palette for the default foreground and background colours. It can be done by writing appropriate escape sequences to your terminal.

For example, this shell command switches your colours to black on white on a QANSI terminal:
x09printf'%c[=0F%c[=7G' 27 27

For more information on escape sequences, look at the docs for Dev.ansi or Dev.con(depending on which terminal emulation are your pterms set to).

How to write your escape sequences to the terminal every time you start a pterm.
There is no completely general way(other than writing your own pterm that uses PtTerminalPut(), to initialize the colors), but for pterms that just run a shell, you can use a script pointed to by your $ENV variable.

Try this:
#ifdef __USAGE
#%C  foreground_color background_color [intense]
#where colors are one of:
#x09x09black, blue, green, cyan, red, magenta, brown, white
#endif
set +o emacs
if [$# -lt 2]
then
x09x09use $0
x09x09exit
fi

case $1 in
x09x09x09black)x09x09x09fc=0;;
x09x09x09blue)x09x09x09x09fc=1;;
x09x09x09green)x09x09x09fc=2;;
x09x09x09cyan)x09x09x09x09fc=3;;
x09x09x09red)x09x09x09x09fc=4;;
x09x09x09magenta)x09x09x09fc=5;;
x09x09x09brown)x09x09x09fc=6;;
x09x09x09white)x09x09x09fc=7;;
x09x09x09*) print "Bad foreground color"; exit ;;
esac
case $2 in
x09x09x09black)x09x09x09bc=0;;
x09x09x09blue)x09x09x09x09bc=1;;
x09x09x09green)x09x09x09bc=2;;
x09x09x09cyan)x09x09x09x09bc=3;;
x09x09x09red)x09x09x09x09bc=4;;
x09x09x09magenta)x09x09x09bc=5;;
x09x09x09brown)x09x09x09bc=6;;
x09x09x09white)x09x09x09bc=7;;
x09x09x09*) print "Bad background color"; exit ;;
esac
printf "