Colours with Linux terminals: How to change the text-mode default from white-on-black
6. How to change the text-mode default from white-on-blackYou will need to tell the terminal driver code that you want another
default. There exists no standard way of doing this, but in case of
Linux you have the setterm program."setterm" uses the information in the terminal database to set the
attributes. Selections are done like
setterm -foreground black -background white -storewhere the "-store" besides the actual change makes it the default for
the current console as well. This requires that the current terminal
(TERM environment variable) is described "well enough" in the termcap
database. If setterm for some reason does not work, here are some
alternatives:6.1 XtermOne of these xterms should be available and at least one of them
support colour.
xterm -fg white -bg blue4
color_xterm -fg white -bg blue4
color-xterm -fg white -bg blue4
nxterm -fg white -bg blue4where 'color_xterm' supports the colour version of 'ls'. This particular
choice resembles the colours used on an SGI.6.2 Virtual console.You may modify the kernel once and for all, as well as providing a
run-time default for the virtual consoles with an escape sequence. I
recommend the kernel patch if you have compiled your own kernel.The kernel source file is /usr/src/linux/drivers/char/console.c
around line 1940, where you should modify
def_color = 0x07; /* white */
ulcolor = 0x0f; /* bold white */
halfcolor = 0x08; /* grey */as appropriate. I use white on blue with
def_color = 0x17; /* white */
ulcolor = 0x1f; /* bold white */
halfcolor = 0x18; /* grey */The numbers are the attribute codes used by the video card in
hexadecimal: the most significant digit (the "1" in the example
colours above) is the background; the least significant the
foreground. 0 = black, 1 = blue, 2 = green, 3 = cyan, 4 = red, 5 =
purple, 6 = brown/yellow, 7 = white. Add 8 to get "bright"
colours. Note that, in most cases, a bright background == blinking
characters, dull background. (From
sjlam1@mda023.cc.monash.edu.au).You may also supply a new run-time default for a virtual console, on a
per-display basis with the non-standard ANSI sequence (found by browsing
the kernel sources)
ESC [ 8 ]which sets the default to the current fore- and background colours.
Then the Reset Attributes string (ESC [ m) selects these colours
instead of white on black.You will need to actually echo this string to the console each time you
reboot. Depending on what you use your Linux box for, several places may
be appropriate:/etc/issueThis is where "Welcome to Linux xx.yy" is displayed under Slackware, and
that is a good choice for stand-alone equipment (and probably be a
pestilence for users logging in with telnet). This file is created at
boottime (Slackware in /etc/rc.d/rc.S; Redhat in /etc/rc.d/rc.local),
and you should modify lines looking somewhat like
echo ""> /etc/issue
echo Welcome to Linux `/bin/uname -a | /bin/cut -d\ -f3`. >> /etc/issueto
ESCAPE="<replace with a single escape character here>"
echo "${ESCAPE}[H${ESCAPE}[37;44m${ESCAPE}[8]${ESCAPE}[2J"> /etc/issue
echo Welcome to Linux `/bin/uname -a | /bin/cut -d\ -f3`. >> /etc/issueThis code will home the cursor, set the colour (here white on blue),
save this selection and clean the rest of the screen. The modification
takes effect after the next reboot. Remember to insert the _literal_
escape character in the file with C-q in emacs or control-v in vi, as
apparently the sh used for executing this script does not understand the
/033 syntax./etc/profile or .profile
if [ "$TERM" = "console" ]; then
echo "\033[37;44m\033[8]" #
# or use setterm.
setterm -foreground white -background blue -store
fi/etc/login or .login
if ( "$TERM" == "console" ) then
echo "\033[37;44m\033[8]"
# or use setterm.
setterm -foreground white -background blue -store
endif6.3 Remote loginYou should be able to use the setterm program as shown above. Again,
this requires that the remote machine knows enough about your
terminal, and that the terminal emulator providing the login supports
colour. In my experience the best vt100 emulation currently available
for other platforms are:MS-DOS: MS-Kermit (free, not a Microsoft product)Windows 95/NT: Kermit/95 (shareware)OS/2: Kermit/95 (shareware). Note though that the
standard telnet understands colours and can be customized locally.See http://www.columbia.edu/kermit/ for details about
Kermit.
-
Wyszukiwarka
Podobne podstrony:
colour ls 3 i2y3a3htwxboisuqldnhk7pmmft6tohtniwed5i i2y3a3htwxboisuqldnhk7pmmft6tohtniwed5icolour ls pl 8colour ls 4 c4cuxdodcxbytow57gmvg5rphby3pqrmm7hwaxq c4cuxdodcxbytow57gmvg5rphby3pqrmm7hwaxqcolour ls pl 1colour ls 5 y6erpussqnugfwff2mfcjppft7z5scteac4feki y6erpussqnugfwff2mfcjppft7z5scteac4fekicolour ls pl 6Colour ls plColour ls pl (3)colour ls 1 ygidk7oxbsgbv3afkfl4i6k4awrr243dexvlvli ygidk7oxbsgbv3afkfl4i6k4awrr243dexvlvlicolour ls pl 4colour ls 2 zm25oj33ku77tgajutuyqthxrp6c2icezwgsc6q zm25oj33ku77tgajutuyqthxrp6c2icezwgsc6qcolour ls pl 5colour ls 7 jtgn4qme2avze324sf3wrekdcfidvyrhtavxdcy jtgn4qme2avze324sf3wrekdcfidvyrhtavxdcycolour ls pl 3Colour ls pl (2)colour ls pl 7colour ls gsxhbohkss2eq3ylbefnrbvhxatqixe5tunvvja gsxhbohkss2eq3ylbefnrbvhxatqixe5tunvvjacolour ls pl 2więcej podobnych podstron