Zagorax Zagorax - 1 year ago 88
Linux Question

How do I change the color of current cursor position indicator?

when I open a terminal I have a black background with white characters. I also have a green placeholder that indicates to me where currently is the cursor.

This behaviour is the same during any perl script that is running in the terminal.

How can I change within the script the color of the cursor indicator (specifically, I want it to disappear for a while and then come back)?

I'm using Linux and bash.

Answer Source

You can change the color of cursor if you change the color of the printed text. So you can't simple change the color of the cursor not changing the color of the text you are printing.

But you can make cursor invisible:

system("tput cinvis"); # make cursor invisible
system("tput cnorm");  # make cursor visible
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download