Learn to Code via Tutorials on Repl.it!

← Back to all posts
Styling Text In Python!
h
JWZ6

Hello! :)

I hope that u guys r doin' great!

Soooooooooooooooooooo...

Welcome to my Python Styling Text Tutorial

(Idk every single way to style, but this is what I know)

Colorizing

How to Use

For example, if you want your text to look red, you can do:

The output will look like this:

Those just some examples on how to use colorizing.

Color Codes (basic)

These are some of the basic color codes

Gray/Grey: "\033[30m"
Red: "\033[31m"
Lime: "\033[32m"
Orange: "\033[33m"
Blue: "\033[34m"
Purple: "\033[35m"
Light Blue: "\033[36m"
Ghostwhite: "\033[37m"

Btw: Ghostwhite is a darker form of white

That was simple!

Color Codes (light)

These are some of the light color codes

Gray/Grey: "\033[90m"
Red: "\033[91m"
Lime: "\033[92m"
Yellow: "\033[93m"
Light Blue 2: "\033[94m"
Light Purple: "\033[95m"
Cyan: "\033[36m"
White: "\033[37m"

Noice...

Bold, Underline, Italic, Dark, Normal, Reset Codes

Reset: "\033[0m"
Bold: "\033[1m"
Dark: "\033[2m"
Italic: "\033[3m"
Underline: "\033[4m"
Normal: "\033[22m"

Phew!

Dark makes the text look blackish and grey/gray.

Reset resets all decoration.

Normal is just normal Python text.

That's It. KTHXBYE!

Edit: I never saw italic and underline before, so I decided to include them.

THESE ARE ANSI CODES

Voters
PYer
Mkgasago
ch1ck3n
Th3Coder
CodeMaster007
JWZ6
Comments
hotnewtop
Bookie0

What's normal? Dark? Reset? Ghostwhite? You could precise what they are exactly. Since this tutorial is kinda short, you could also try explaining how they work. And you havn't used the word 'ANSI' anywhere...

Also, you can use syntax highlighting in your codeblocks by adding py after the 3 backticks (`):

JWZ6
Bookie0

@JWZ6 np :)

JWZ6

@Bookie0 btw sorry i is not knowing ANSI but ill try

Bookie0

@JWZ6 well, you're using these ANSI codes for the colors.

JWZ6

@Bookie0 oh really? nice :) (glad you put the effort into helping others)

Bookie0

@JWZ6 uh yeah lol. np :) You can check this wikipedia page to know more about ANSI escape codes if you want, as well as this video

JWZ6
Bookie0

no problem :D @JWZ6

JWZ6
ch1ck3n

Me and darkdarcool made a PyPI package to help with styling as well:

https://pypi.org/project/ConsoleHelp/

so uh well

use it

JWZ6

@ch1ck3n YAY cool!

JWZ6

@ch1ck3n did you ACTUALLY create that?

ch1ck3n

@JWZ6 i helped

JWZ6
JWZ6

@ch1ck3n btw my customize thingy is fixed so yeah! no more problems n stuff... https://replit.com/talk/share/A-Little-Text-Editor-I-Created/135398 lol

[deleted]

[deleted]

noice

Th3Coder
JWZ6
Th3Coder

@JWZ6 you're welcome!

JWZ6

@Th3Coder lol np (me remembering your welcome meme song)

Th3Coder
Th3Coder

@amasab all hail the 100% totally legitimately real unfake CEO!

[deleted]

@Th3Coder xDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD

JWZ6
JWZ6
CodeMaster007

Nice! Can you also put the code below so its easier to see it in actions! Thanks!

JWZ6
JWZ6

@CodeMaster007 OK DONE :)

CodeMaster007

Thanks! :) @JWZ6

JWZ6
JWZ6

If you like this, you might like my little JavaScript tutorial: https://replit.com/talk/learn/JS-BASIC-Tutorial/135309 @CodeMaster007