On Wed, 10 Apr 2024 at 18:51, WordWeaver Evangelist via Python-list
<python-list@python.org> wrote:

> I have a simple question. I use the following textPrompt in some of my
> Jython modules:

>  '\n [1;33mYour choice is? (A B C D E): ', maxChars=1, autoAccept=False, 
> forceUppercase=True)

> Is there a way to add an ANSI color code to the end where the conditions
> are, so that the color of the user’s input is of a color of my choosing,
> instead of just white?

Hi Bill,

Here's a tutorial:
  https://www.lihaoyi.com/post/BuildyourownCommandLinewithANSIescapecodes.html
Note the sentence: "once you print out the special code enabling a color,
the color persists forever until someone else prints out the code for
a different color, or prints out the Reset code to disable it."

Here's a more detailed specification:
  https://en.wikipedia.org/wiki/ANSI_escape_code

And here's a conversation:
  http://mywiki.wooledge.org/BashFAQ/037
(see the first sentence, and then under the heading "Discussion")
that might help you decide whether this approach will satisy your need in
your particular circumstances of operating system, Python version, and
terminal settings.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to