Part Five!
Don’t miss next issue, subscribe on page 16!
Part Five!
Don’t miss next issue, subscribe on page 16!
Credit: https://github.com/fritzone/lxf-shell
OUR EXPERT
Ferenc Deák
is a colourful chap, bursting with ideas and expertise to not only add a splash of colour to the LXF Shell, but also to make it increasingly useful.
OUR EXPERT
Ferenc Deák is a colourful chap, bursting with ideas and expertise to not only add a splash of colour to the LXF Shell, but also to make it increasingly useful.
Having taken a well-deserved pause, which we spent in the world of demo colours and pixels, H we’re ready to honour the pledge we made in the fourth episode of our shell series, and we’re back. Here we stand, poised to delve deeper into the intricacies of the Linux terminal and shell functionality. Not surprisingly after being affected by the colourful series on 90s demoscene effects (see LXF315-LXF318), our focus today is on the visually striking features of the Linux terminal, and how we can use them in our shell. So, be prepared for colours and curses.
Beyond black and white
In Linux terminals, printing coloured text is achieved through ANSI escape codes. These provide a means to specify text colours, background colours and text formatting. By incorporating these codes into your commands, you can create visually appealing and informative displays right in your terminal window.
The syntax for using ANSI escape codes is straightforward. Here’s a basic example: $ echo -e “\e[31mThis is red text\e[0m”
Let’s dissect this command:
\e[31m : Sets the text colour to red. This is red text : Your desired text output.
\e[0m : Resets the text colour to the default. The output of the command above is the following:
QUICK TIP
The code for the shell can still be found at https://github. com/fritzone/lxf-shell.
QUICK TIP
The code for the shell can still be found at https://github. com/fritzone/lxf-shell.