📅 November 13, 2015
If you enjoy using figlet to produce fancy text within a terminal, then why not give toilet a try?
Not only is toilet compatible with figlet’s fonts, but basic filters can be applied that color the text, add a border, and flip and flop without the need for Imagemagick.
Installation
Toilet is available from the repository (Ubuntu-based). To install toilet,
sudo apt-get update
sudo apt-get install toilet
And install figlet if you do not have it already.
sudo apt-get install figlet
About toilet
Think of toilet as “figlet with filters.” Toilet does much the same as figlet, but with more features. If specifying a font using the -f option, toilet can produce the same output as figlet.
Fonts are located in the same /usr/share/figlet directory as .flf files, so make sure that figlet is installed in order to use them.
In the example, both use the same font, smblock. Without specifying a font, toilet produces something like this:
Consult man toilet to view the full list of options.
Filters
Filters are what set toilet apart from figlet. Using a filter, we can give the text a metal-like appearance using blue and gray colors.
To view a list of filters, enter toilet –filter list at the command prompt in a terminal. There are not many filters to choose from, but they are enough play with.
To use a filter, enter the –filter option followed by the filter’s name.
toilet --filter metal 'Linux is fun!'
Filters can be combined using a colon-delimited list of filter names.
--filter border:metal
Adds a colored border around colored text.
--filter border:metal:flip
Flips the texts horizontally, colors it, and adds a border.
--filter border:metal:flip:flop
Displays colored text upside down and backwards within a border.
Adjusting the Width
Sometimes the default 80-column wrap is too much. We can adjust the width using the -w option followed by the number of columns at which to wrap.
HTML Output
With the –html option, toilet will output the result to an HTML file so you can use the styled text in a web browser.
toilet -f smblock --filter border:metal 'Welcome to the colored toilet!' --html > test.htm
toilet --export list
the –export list option will list all possible output formats the generated text can be exported to.
Output Image
toilet will output to an .svg or .tga file, so images are possible. Use the –export svg or –export tga and redirect the output to a file.
toilet -f smblock --filter border:metal 'Welcome to the colored toilet!' --export svg > test.svg
More ASCII Fun
Try combing toilet with other programs, such as fortune and cowsay.
fortune | cowsay | toilet --metal -f term
fortune | cowsay -f eyes | toilet --metal -f term
linuxlogo -a -l | toilet --metal -f term
linuxlogo -logo -a | toilet -f term --filter flip | lolcat
toilet -f ivrit 'Linux is fun!' | boxes -d cat -a hc -p h8 | lolcat
Conclusion
Is toilet useful? Why, YES! If you enjoy twiddling with ASCII art, ASCII banners, and find ASCII creations to be wonderful playthings, then toilet belongs in the ASCII toolbox alongside figlet, cowsay, linuxlogo, and all of the other fun ASCII generation programs.
Have fun!