How to Create ASCII Text Banner for Command-Line Project
A few days ago I got a practicum assignment in the “Programming Fundamentals” course, ordered to make a CRUD application. We were instructed to create a CRUD application using Python3.
After the project was finished I felt bored with the command-line app, so I added a banner to make it more attractive like the picture above.
There are 2 topics in this article:
- Create a banner.
- Add a banner to the python command line.
Here are the steps to make a banner:
- Open https://patorjk.com/software/taag/ in your new tab.
- There is a “Type Something” form, you can change it according to your project name.
- Click the “Test All” button, and the page will automatically generate all banner fonts, you can choose whatever you like.
Following are the steps for adding banners to the code project
- After selecting a font, you can copy and paste it into the code editor.
- You can place it in the banner() function or just store it in a variable.
def banner():
font = """
____ __ ____ _
____ ____ ___ __/ __/___ _/ / ____ __________/ / /_ ____ _____ (_)
/ __ \/ __ `/ / / / /_/ __ `/ / / __ `/ ___/ __ / __ \/ __ `/ __ \/ /
/ / / / /_/ / /_/ / __/ /_/ / / / /_/ / / / /_/ / / / / /_/ / / / / /
/_/ /_/\__,_/\__,_/_/ \__,_/_/ \__,_/_/ \__,_/_/ /_/\__,_/_/ /_/_/ """
print(font)
if __name__ == "__main__":
banner()
or
banner = """
____ __ ____ _
____ ____ ___ __/ __/___ _/ / ____ __________/ / /_ ____ _____ (_)
/ __ \/ __ `/ / / / /_/ __ `/ / / __ `/ ___/ __ / __ \/ __ `/ __ \/ /
/ / / / /_/ / /_/ / __/ /_/ / / / /_/ / / / /_/ / / / / /_/ / / / / /
/_/ /_/\__,_/\__,_/_/ \__,_/_/ \__,_/_/ \__,_/_/ /_/\__,_/_/ /_/_/ """
print(banner)
You can also give color to the banner with the code below:
RED = "\33[91m"
BLUE = "\33[94m"
GREEN = "\033[32m"
YELLOW = "\033[93m"
PURPLE = '\033[0;35m'
CYAN = "\033[36m"
END = "\033[0m"
banner = f"""
{RED} ____ __ ____ _
____ ____ ___ __/ __/___ _/ / ____ __________/ / /_ ____ _____ (_)
/ __ \/ __ `/ / / / /_/ __ `/ / / __ `/ ___/ __ / __ \/ __ `/ __ \/ /
/ / / / /_/ / /_/ / __/ /_/ / / / /_/ / / / /_/ / / / / /_/ / / / / /
/_/ /_/\__,_/\__,_/_/ \__,_/_/ \__,_/_/ \__,_/_/ /_/\__,_/_/ /_/_/ """
print(banner)
{RED} will not affect the banner spacing or throw it an error, it will only color the banner.
The following is the repository URL for the example project I made https://github.com/naufalardhani/uts_praktikum_pert-14.
Hope this article helps you to make command-line programs more attractive, good luck guys!