Skip to content
Sign upLog in
← Back to Community


Profile icon

How do i make a text red and make it scroll,I want it so i can make my project cool

Profile icon
Profile icon
Profile icon


Profile icon

def scrollTxt(text): for char in text: sys.stdout.write(char) sys.stdout.flush() sleep(text)

Profile icon

put all the colors on seprate lines

Profile icon

import sys from time import sleep black = "\033[0;30m" red = "\033[0;31m" green = "\033[0;32m" yellow = "\033[0;33m" blue = "\033[0;34m" magenta = "\033[0;35m" cyan = "\033[0;36m" white = "\033[0;37m" bblack = "\033[0;90m" bred = "\033[0;91m" bgreen = "\033[0;92m" byellow = "\033[0;93m" bblue = "\033[0;94m" bmagenta = "\033[0;95m" bcyan = "\033[0;96m" bwhite = "\033[0;97m" bold = '\033[1m'

Profile icon


To make your text scroll and be red. Try this code:

import time from termcolor import colored import sys for x in colored("WELCOME!", "red"): sys.stdout.write(x) sys.stdout.flush() time.sleep(0.05)

So that will make it red, and make the text scroll
That should work

Profile icon

Check out my tutorial here explaining how.

Typewriter effect

Now this typewriter effect is super cool, because it makes the text print one letter at the time. You can regulate it so that it prints the text fast or slow.
First the imports:

import sys, os import time

And this is the code:

st = 0.04 def sp(str): for letter in str: sys.stdout.write(letter) sys.stdout.flush() time.sleep(st) print()

I usually put it at 0.04because it prints it not too fast and not too slow. But you can change it. Just change the value after st

Each time you want to do this typewriter effect, just do:

sp(“Hello World”)


Hello World

(Outputted at one char every 0.04 seconds)

This is how to make colors in Python.

Pretty simple, just copy paste these colors (because typing them would be to long...)

# colors black = "\033[0;30m" red = "\033[0;31m" green = "\033[0;32m" yellow = "\033[0;33m" blue = "\033[0;34m" magenta = "\033[0;35m" cyan = "\033[0;36m" white = "\033[0;37m" bright_black = "\033[0;90m" bright_red = "\033[0;91m" bright_green = "\033[0;92m" bright_yellow = "\033[0;93m" bright_blue = "\033[0;94m" bright_magenta = "\033[0;95m" bright_cyan = "\033[0;96m" bright_white = "\033[0;97m"

So to use it, just put the color before the text:

print(bright_yellow + “text here”)

This also works with the slowPrintI mentioned earlier

Profile icon

You can use colorama to color text, like this:

from colorama import Fore print(Fore.RED + 'Ooh, some cool red text!') ## or you can use acii color codes red = '\u001b[31m' print(red+'still red text, cool huh?') # you can get color codes just by googling 'python ANSI color codes'

and for scrolling text:

import sys import time def scroll(str): for char in str: sys.stdout.write(char) sys.stdout.flush() time.sleep(.02) #change this time to change how long it waits between each character print()

And together:

scroll(red+"Haha, red scrolling text!")