🐍 Python Text Styles 🐍
Python Text Styles!
Today we're going to learn:
- italic, bold, underline
- all the colors (I know)
Alright! Let's begin:
print("Welcome to python text style tutorials.")
How do we make that text prettier?
First, let's add color
To add color, you can import it. However, a fancier way can be used (I prefer this way).
print("\033[0;36mblue text :D")
WWHHAAT?
So, add the \033[ first.
After that, add either 0,1,2,3 or 4.
0: Normal text
1: Bold
2: Pale
3: Italic
4: Underline
psst: TIPS!
If you are doing let's say pale then bold,
Make sure to do \033[0;1;39m (You can change
the color, of course) But please remember to
clarify it's not pale anymore-
With the 0. Or else... dun dun dun
Alright. Now add that, and we have
print("\033[1;Colored text")
You run the code.
Er, it's not working
Right. We must add the color. Go to main.py to see more, but you can also stay here.
Red: 31
Orange: 33
Yellow: 93
Green: 32
Cyan: 36
My favorte, light blue: 94
Blue: 34
Purple: 35
Gray: 37
White: 39
print("\033[1;36Colored text)
Still not working.
Add a m after the number for your color.
e.g. "\033[1;36mColored text"
phew!
Should be working now, have fun using the colors! If you discover any new colors or have any questions, comment here.
Can you also use RGB-colors for printing a string?
@ZhongRietveld I don’t think so but I’m not like a python color expert or smth so maybe you could search it up? I really wish they would allow RGB colors or hex codes. If you find anything interesting you can tell me!! ↓
@SilvermoonCat I had search it on the internet and guess what? You can RGB color print!
print("\033[38;2;R;G;BmHello World")
@ZhongRietveld wow, cool! I’ll try it sometime :D
how do you do yellow
@JULIODIAZ1 ooh I should add that...
print("\033[1;93mThis is yellow text")
#bolded because of the 1
@SilvermoonCat thanks!
Nice job, this is pretty helpful
thanks :) @FloCal
I already know most of these but it’s one of the things I always suggest to people and it’s just what every python repl needs!!! It’s not toooooo coding related but nice job!!!
@LuckyOreos
thanks :D Since I'm not good at codes so i have to do this stuff--
@SilvermoonCat It’s alright you still put in a lot of effort
umm that is very annoying use variables that hold the ANSI escape codes lol..