REPL.it Color, Effects and Emojis

Liven Up Your POSIX Terminal App

Update: A student has actually got marquee-like text animation working as well as staggered typing making the program feel like someone you are chatting with on the other end.

Typing Simulation and Marquee Text Animation

Adding color to a simple terminal text program really makes a difference—especially when encouraging young beginners to focus on just the code. I have noticed that when given a chance many are actually attracted to the idea of a program that requires no graphic interface. Perhaps it is the “hacker” feel of the experience. Color and effects make it even more enticing.

Not All Terminals Are Alike

Unfortunately few follow the POSIX standard for terminals and even fewer actually support emojis (UNICODE). REPL.it supports the important colors and the effects (although apparently not simultaneously). REPL.it also support emojis completely. This is enough to have a lot of fun simply with text-based user interfaces.

Windows does not support POSIX or emojis in any standard terminal. There are ways to get around that. Most will consider installing VSCode and running their POSIX and emoji code from a terminal under VSCODE.

Mac has full support for everything (which is probably why it is so popular with developers, or at least has been over the years). The brew tool even uses a frosty mug in it’s progress status output.

All You Need is Some Variables

All anyone needs to take advantage of colors and effects are some variables with the standard escape codes (which are invisible to the terminal). This means that you actually do not need modules like the Python termcolor because you can just print the variable. This makes using them immensely easier and allows things that cannot be done with any module that forces you to use a function, like setting the color of input() text.

Python Terminal Colors Using Only Variables

This example is for Python, but the principles works in any language, including LOLCODE. (Have a look at other REPLs that start with color-effects- on my REPL.it site.)

No Support for Clear and Backspace

REPL.it does not (currently) support the special escapes to clear the screen, backspace, and clear a line. This is why they have added replit.clear() (to Python only at this point). At some point adding proper support may allow entertaining text animations and progress bars, but for now you will need a POSIX real terminal to play with that. Still, sprucing your command line programs on REPL.it with color, effects, and emojis adds to the fun.

Like what you read? Give Rob Muhlestein a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.