How to change shell colors without messing programs?
  • Order of the Butterfly
    Order of the Butterfly
    hiTCH-HiKER
    Posts: 169 from 2003/12/31
    I want to have a shell with black background and white or light grey text. When I use ANSI codes to change the colors it works great in the shell, but programs like VIM or OpenSSH will show black text on the black background. Another annoying thing is, when I switch between two shell tabs, then the background is grey again. How can I change the shell colors without running into this kind of problems?
  • »28.03.04 - 19:35
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    DoctorMorbius_FP
    Posts: 315 from 2004/2/14
    From: Naples - Italy
    Put in your shell-startup a command like this:

    Echo "*E[0;0;0;0V *E[1;220;220;220V *E[2;180;180;0V *E[3;80;208;248V *E[4;238;68;68V *E[5;85;220;85V *E[6;0;68;221V *E[7;238;153;0V *Ec" NoLine

    (This should be a single line of text: I've inserted spaces between the quotes for readability, but they are not needed.)

    This will set the background to black, the text to white, highlighted text to yellow, and so on. Then you can write text in these colours with ANSI commands like these:

    Echo "*E[31m This is white text"
    Echo "*E[32m This is yellow text"
    Echo "*E[33m This is light blue text"
    Echo "*E[34m This is red text"
    Echo "*E[35m This is light green text"
    Echo "*E[36m This is blue text"
    Echo "*E[37m This is orange text"

    Echo "*E[43m This activates light blue background"

    Echo "*E[34;46m This activates red text on blue background"

    The simplest colour setting command for the MorphOS shell has the following format:

    Echo "*E[n;x;y;zV"

    where n is the number of the colour you want to set, and x, y, z are the decimal RGB values that define that colour.

    You will find the full set of ANSI escape codes for classic Amiga in the file dev/misc/AmigaANSI.txt on Aminet.
    Powered by PegasosII-G4, MacMini, PowerMac MDD.
  • »28.03.04 - 20:59
    Profile Visit Website
  • Order of the Butterfly
    Order of the Butterfly
    hiTCH-HiKER
    Posts: 169 from 2003/12/31
    Great, it works now! Thanks a lot... the predefined colors are horrible when using a small font ;)
  • »28.03.04 - 21:14
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    hiTCH-HiKER
    Posts: 169 from 2003/12/31
    Is there a way to prevent the shell from restoring to the ugly default colors when returning from iconified state?
  • »28.03.04 - 22:22
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    DoctorMorbius_FP
    Posts: 315 from 2004/2/14
    From: Naples - Italy
    > Is there a way to prevent the shell from restoring to the ugly default colors when returning from iconified state?

    I don't know. But there is a simple workaround. Create an alias in your shell-startup for the Echo command that sets the shell colours:

    Alias SetSC Echo "..."

    When the shell returns from the iconified state, type SetSC to restore the colours, and press <ALT>-<UpArrow> to restore the history.
    Powered by PegasosII-G4, MacMini, PowerMac MDD.
  • »29.03.04 - 00:21
    Profile Visit Website