lazarus78
Posts: 236
Joined: Thu Jul 25, 2013 5:16 pm

Changing terminal colors

Tue Nov 12, 2013 11:35 pm

How can I change the actual color values of terminal colors from the prompt? IE change the shade of red or blue used. The defaults are too bright or dark.

elatllat
Posts: 1337
Joined: Sat Dec 17, 2011 5:05 pm

Re: Changing terminal colors

Wed Nov 13, 2013 3:25 am

LS_COLORS is likely what you arelooking for.

http://www.geekgumbo.com/2011/11/04/cha ... ash-shell/
2160p + USB3 + Wayland: https://hardkernel.com

FAQ : https://raspberrypi.stackexchange.com

Unanswered: https://www.raspberrypi.org/forums/search.php?search_id=unanswered

lazarus78
Posts: 236
Joined: Thu Jul 25, 2013 5:16 pm

Re: Changing terminal colors

Wed Nov 13, 2013 9:45 am

No, not even close. Ive found tons and tons of such sites with that info, but its not what I am looking for.

I want to change what color "red" is, or change what shade of blue is used when i type in "\e[34m". NOT the color codes used for the LS command.


Example. Debian uses these colors:
https://scottlinux.com/wp-content/galle ... prompt.png

Raspberry uses these:
http://debianhelp.files.wordpress.com/2 ... 4o-jpg.png


I want to change the colors of the raspberry console colors to be like Debian, but I want to do it through the prompt, not the gui terminal "profile" stuff.

JustThisGuy
Posts: 114
Joined: Thu Jan 05, 2012 11:22 pm

Re: Changing terminal colors

Wed Nov 13, 2013 11:26 am

Check out the command setvtrgb.
Any conversation about a sufficiently complex subject is indistinguishable from babble.

lazarus78
Posts: 236
Joined: Thu Jul 25, 2013 5:16 pm

Re: Changing terminal colors

Wed Nov 13, 2013 6:33 pm

Could use a bit more explanation. Google only yields the basic man page which is borderline unhelpful. The only useful bit is "cat /sys/module/vt/parameters/default_{red,grn,blu} > FILE", but it doesn't tell you what to do with this information. I understand it populates a file with RGB value data, but what do those mean? What is it for? What is it doing and how do I manipulate it for my purposes?

JustThisGuy
Posts: 114
Joined: Thu Jan 05, 2012 11:22 pm

Re: Changing terminal colors

Wed Nov 13, 2013 8:04 pm

The man page on raspbian is slightly more helpful, showing a table mapping the escape codes to default colors.

The kernel keeps a table of colors used by the virtual terminal. There are 15 to choose from and they correspond to the 'white, black, red, ...cyan' etc colors that can be displayed. Each of these numbers can be set to any RGB specification.

To see what the default spec is you do that 'cat' command into FILE. This file has 3 lines each line contains 15 numbers. The first number in each line contains the red, green,or blue component value respectively for the first displayable color. The second number in each line is value for the second displayable color and so on. (I'm away from my RPi so I'm doing this from memory) For example, the 2nd color is LIGHT RED or 170,0,0. To change this to display blue the numbers change to 0,0,170.

Default color 'map' FILE would contain

Code: Select all

0,170,0,170,0,170,0,170,85,255,85,255,85,255,85,255
0,0,170,85,0,0,170,170,85,85,255,255,85,85,255,255
0,0,0,0,170,170,170,170,85,85,85,85,255,255,255,255
edit it to become:

Code: Select all

0,0,0,170,0,170,0,170,85,255,85,255,85,255,85,255
0,0,170,85,0,0,170,170,85,85,255,255,85,85,255,255
0,170,0,0,170,170,170,170,85,85,85,85,255,255,255,255
then execute the command

Code: Select all

setvtrgb FILE
which will set the kernel color map to the new definition of RED which will display as the color BLUE. Note that the escape codes (31;01) will still be the same but this should give you control of the 15 possible colors on the console.
Any conversation about a sufficiently complex subject is indistinguishable from babble.

lazarus78
Posts: 236
Joined: Thu Jul 25, 2013 5:16 pm

Re: Changing terminal colors

Wed Nov 13, 2013 11:41 pm

That is far more help then the man page was offering. Thank you.

Another thing. Is this a permanent change? Can I edit the files directly to make it permanent?

JustThisGuy
Posts: 114
Joined: Thu Jan 05, 2012 11:22 pm

Re: Changing terminal colors

Thu Nov 14, 2013 12:27 am

Actually, I gleaned most of that from the raspbian man page.

As for the persistence I'm not sure. You may have to put a setvtrgb command in your .bashrc or .profile, or probably more correctly in with the sysint stuff in rc.d. But definitely try rebooting it without doing that first and see what happens.

You're welcome.
Any conversation about a sufficiently complex subject is indistinguishable from babble.

lazarus78
Posts: 236
Joined: Thu Jul 25, 2013 5:16 pm

Re: Changing terminal colors

Thu Nov 14, 2013 6:31 pm

Then you are far better at pulling information out of those man pages then I, cus i never would have gotten any of that from little there was.

Thanks for your help.

petEEy
Posts: 1
Joined: Fri Jun 19, 2015 11:44 pm

Re: Changing terminal colors

Wed Sep 09, 2015 5:20 pm

Can setvtrgb be used with LXTerminals in the desktop environemnt? I can successfully set the colors in the TTY login shells, but when I use setvtrgb on a terminal open in the graphical desktop environment, I get the error "Couldn't get a file descriptor referring to the console". Using "sudo setvtrgb FILE" does not produce this error, but it also doesn't change any of the colors.

Return to “Beginners”