pdksh's ksh(1) says:
PS1 is the primary prompt for interactive shells. Parameter,
command and arithmetic substitutions are performed, and ! is
replaced with the current command number (see fc command below).
A literal ! can be put in the prompt by placing !! in PS1. Note
that since the command line editors try to figure out how long
the prompt is (so they know how far it is to edge of the
screen), escape codes in the prompt tend to mess things up. You
can tell the shell not to count certain sequences (such as
escape codes) by prefixing your prompt with a non-printing char-
acter (such as control-A) followed by a carriage return and then
delimiting the escape codes with this non-printing character.
If you don't have any non-printing characters, you're out of
luck... BTW, don't blame me for this hack; it's in the original
ksh. Default is `$ ' for non-root users, `# ' for root..
When I first came across this, I was confused on how to color my prompt, and didn't quite understand the logic. What it basically says is to define a non-printing character of your choice to then use to quote other non-printing characters to tell the shell what to exclude from counting.
However, I had a hard-time to get that to work, and once it worked, I tried putting it into .shrc, and it failed, escaping became a mess, etc.. After a while I got it to work using tput. Anyways, having an example back then would've been pretty helpful, but I didn't find any - so here is one - my PS1 (for shells/{pd,m}ksh on FreeBSD), simply displaying a green $:
PS1=$(tput bel;tput cr;tput setaf 2;tput bel)'$ '$(tput bel;tput op;tput bel)