Find the answer to your Linux question:
Results 1 to 2 of 2
Hey Guys, I know there is a way to change the color of text on the command line, but is there a way to change the color of a single ...
  1. #1
    Just Joined!
    Join Date
    Oct 2008
    Posts
    2

    Coloring Individual Characters

    Hey Guys,

    I know there is a way to change the color of text on the command line, but is there a way to change the color of a single character in a word?

    Thanks!

  2. #2
    Content Team _madman_'s Avatar
    Join Date
    Jun 2006
    Posts
    53
    There is no such thing as a great question, only great people, and you are one. I'm working on this one right now. I had a similar interest a while back and never followed through on it. To make sure we are on the same page: you do mean apart from the command prompt itself, how do you colorize each letter individually, possibly randomly, right?

    I imagine one could use ANSI escapes to move the cursor through each individual character space across the line, cycling the color each time, and then reset the cursor to the beginning of the line. Leaving the original (or possibly a different) background with a blank space having a random foreground value. The freshly typed text would probably wipe those values out though (with what ever color the prompt ended with, like normal).

    Another possible option is to parse the text as it is typed on the command line. You could do cool stuff like syntax highlighting this way. Through a script...?

    My experience in this area is lacking - thanks for motivating me to change that.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...