DEV Community

Iqra Masroor
Iqra Masroor

Posted on

Releasing Your Inner Unicorn

Welcome, readers. Today, I will be showing you all how you can reach deep into your soul and find your rainbow.

Recently, a friend and I developed a simple CLI application that allows users to order coffee using Ruby. It performed simple CRUD actions that are able to take in user input. Let’s sidetrack for a second, CRUD stands for Create, Read, Update and Delete, and is the life of coding.

I was amazed at what we had created! Our application was able to perform all these methods (shoutout to Julz)! Now, what bothered me was how plain and boring it looked. Well, it is a CLI app what else would you expect, is what you might be thinking but coming from a design background: I did not like it at all. So I embarked on a journey to find a way to add a wow factor to our CLI app. After many quests, and article after article about the colorize gem, I read about a 'unicorn'. That's right: a unicorn - or a Ruby Gem called 'LOLCAT'.

Now what this gem does is that it prints out your whole terminal in a rainbow-like so:

Alt Text

If you want your terminal to spit out all its info in color simply follow the following steps:

Using LOLCAT directly in the command line.

  1. Open up your terminal.
    Alt Text

  2. Type in 'gem install lolcat'.

  3. Once installed simply add '| lolcat' after a command.
    Alt Text

  4. Now you can add a splash of color in your dark dark terminal life.

Alt Text

Using LOLCAT within a program.

Now if you want to use this within a program simply do the following:

  1. First, create a method (or don't if you don't want to...).
  2. Then, write fork{ } . This allows you to run the lolcat command in the program itself.
  3. Finally, Within the { } add whichever file or method you want to call lolcat on. like so: Alt Text

The code above created the following results:
Alt Text

I have mentioned fork but you might be asking yourself what the -a and -d stand for? In this specific piece of code, we wanted our title screen to be animated so -a stands for animate and -d stands for the duration. The title is now an animation that runs for 4 seconds.

This was able to help me add a few gems to the project (pun intended) and make it sparkle.

If you're still a bit iffy about how to lolcat feel free to check out their GitHub link here, but what helped me the most was this article written by Deka Ambia. I definitely recommend reading this once if you want to use lolcat within your program.

Alt Text

Thanks for reading!

Top comments (0)