Tiny Core Linux
Tiny Core Base => TCB Q&A Forum => Topic started by: deetee on April 22, 2013, 05:58:07 AM
-
Hi all!
I would like to set the colors for background and foreground in the console.
I used to do it with 'setterm' which seems to be a bash-specific command, which is not supported from TC (ash, busybox-shell).
I found a way to do it with 'ESC-sequences' (i.e. 'echo -e "\033[40;1m"'), but this seems to be to complicated (need of a list for color- and effect-codes).
Is there a simpler way to change the forground and background color?
TIA deetee
-
Hi deetee
See this thread:
http://forum.tinycorelinux.net/index.php/topic,13078.msg72055.html#msg72055
-
Thanks for the link.
To install the package (util-linux-ng.tcz) to use setterm seems to be a fast and comfortable solution.
But regarding to a 'small footprint' - which is the primary focus of TC - installing a further package should be the second best solution.
Maybe I can automate the ESC-sequences (script) if there is no 'best solution'?
deetee
-
Hi deetee
You could always pull out setterm if you don't need anything else from util-linux.tcz. You might also need libtinfo.so.5.
You can create an extension out of those two files (see the Wiki) or copy them from /tmp/tcloop/... to /usr/local/... and
add them to your backup. If you just need colored text, there are color functions defined in /etc/init.d/tc-functions that
you can call from a script. Look in /etc/init.d/tc-config to see how to include /etc/init.d/tc-functions and how to use colors.
-
Hi Rich!
Thank you so much for your excellent hints.
'Extracting' the binaries of setterm is a good idea, but seems to 'intervent' to much the TC-system (I can't explain it better, but that's a gut feeling).
I ever wondered where the variables RED, GREEN, etc. are defined in TC. Now I know that this is done in /etc/init.s/tc-functions (maybe I should analize the TC-system better).
To change the color of the foreground with i.e. 'echo $RED' helps me a lot. Unfortunately TC doesn't define variables for the background (i.e. "BGRED=$(echo -e '\033[1;41m')"). But that's what I could add and automate with a script.
Thanks for guiding me the right way.
Regards deetee