Rich performs highlighting on the output, for numbers, strings, data etc. In your example it is highlighting braces, which can be helpful when you print data structures.

You can disable this feature if you construct a Console object and set highlight=False on the print method.

Here's an example:

from rich.console import Console
console = Console()
console.print('[[green]1[/green]] Create new password', highlight=False)

See the docs on highlighting for the details.

Answer from Will McGugan on Stack Overflow
Top answer
1 of 2
7

Rich performs highlighting on the output, for numbers, strings, data etc. In your example it is highlighting braces, which can be helpful when you print data structures.

You can disable this feature if you construct a Console object and set highlight=False on the print method.

Here's an example:

from rich.console import Console
console = Console()
console.print('[[green]1[/green]] Create new password', highlight=False)

See the docs on highlighting for the details.

2 of 2
0

As the op is open to other ways, here is my way of doing..

Initiate a class with standard terminal color codes.

class bcolors:

    ResetAll = "\033[0m"

    Bold       = "\033[1m"
    Dim        = "\033[2m"
    Underlined = "\033[4m"
    Blink      = "\033[5m"
    Reverse    = "\033[7m"
    Hidden     = "\033[8m"

    ResetBold       = "\033[21m"
    ResetDim        = "\033[22m"
    ResetUnderlined = "\033[24m"
    ResetBlink      = "\033[25m"
    ResetReverse    = "\033[27m"
    ResetHidden     = "\033[28m"

    Default      = "\033[39m"
    Black        = "\033[30m"
    Red          = "\033[31m"
    Green        = "\033[32m"
    Yellow       = "\033[33m"
    Blue         = "\033[34m"
    Magenta      = "\033[35m"
    Cyan         = "\033[36m"
    LightGray    = "\033[37m"
    DarkGray     = "\033[90m"
    LightRed     = "\033[91m"
    LightGreen   = "\033[92m"
    LightYellow  = "\033[93m"
    LightBlue    = "\033[94m"
    LightMagenta = "\033[95m"
    LightCyan    = "\033[96m"
    White        = "\033[97m"

    BackgroundDefault      = "\033[49m"
    BackgroundBlack        = "\033[40m"
    BackgroundRed          = "\033[41m"
    BackgroundGreen        = "\033[42m"
    BackgroundYellow       = "\033[43m"
    BackgroundBlue         = "\033[44m"
    BackgroundMagenta      = "\033[45m"
    BackgroundCyan         = "\033[46m"
    BackgroundLightGray    = "\033[47m"
    BackgroundDarkGray     = "\033[100m"
    BackgroundLightRed     = "\033[101m"
    BackgroundLightGreen   = "\033[102m"
    BackgroundLightYellow  = "\033[103m"
    BackgroundLightBlue    = "\033[104m"
    BackgroundLightMagenta = "\033[105m"
    BackgroundLightCyan    = "\033[106m"
    BackgroundWhite        = "\033[107m"

Your Program

print(f"[{bcolors.Green}1{bcolors.ResetAll}] Create new password")
print('[2] See existing passwords')
print('[3] Exit')

Output:

🌐
Rich
rich.readthedocs.io β€Ί en β€Ί stable β€Ί appendix β€Ί colors.html
Standard Colors β€” Rich 14.1.0 documentation
╔════════════╀════════╀═══════════════════════╀═════════╀══════════════════╗ β•‘ Color β”‚ Number β”‚ Name β”‚ Hex β”‚ RGB β•‘ β•Ÿβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β•’ β•‘ β”‚ 0 β”‚ "black" β”‚ β”‚ β•‘ β•‘ β”‚ 1 β”‚ "red" β”‚ β”‚ β•‘ β•‘ β”‚ 2 β”‚ "green" β”‚
🌐
GitHub
github.com β€Ί Textualize β€Ί rich
GitHub - Textualize/rich: Rich is a Python library for rich text and beautiful formatting in the terminal. Β· GitHub
Rich is a Python library for rich text and beautiful formatting in the terminal. The Rich API makes it easy to add color and style to terminal output.
🌐
Pybites
pybit.es β€Ί articles β€Ί learning-rich-by-making-a-color-searcher-command-line-app
Learning Rich by making a color searcher command line app – Pybites
I first looked around to get a mapping of color names -> hex codes. I found this resource (thanks codebrainz). To make sure this data would not change I forked the repo (I believe forks will survive original repos being deleted). ... from pathlib import Path from urllib.request import urlretrieve from rich.console import Console console = Console() colors_csv_url = "https://raw.githubusercontent.com/bbelderbos/color-names/master/output/colors.csv" colors_csv_file = Path(colors_csv_url).name def download_data(): console.print("Grabbing colors.csv from GitHub") urlretrieve(colors_csv_url, colors_csv_file) console.print("Adding header to the file") with open(colors_csv_file, 'r') as f: data = f.read() with open(colors_csv_file, 'w') as f: header = "name,name2,hex,r,g,b" f.write(f"{header}\n" + data)
🌐
YouTube
youtube.com β€Ί watch
Python Rich - The BEST way to add Colors, Emojis, Tables and More... - YouTube
In this video, I go over my Favorite Python Module - Python Rich. Python Rich allows you to add color, emojis, tables, progress bars, and more to your pytho...
Published: February 1, 2021
🌐
Rich
rich.readthedocs.io β€Ί en β€Ί latest β€Ί style.html
Styles β€” Rich 14.1.0 documentation
In various places in the Rich API you can set a β€œstyle” which defines the color of the text and various attributes such as bold, italic etc.
🌐
PyPI
pypi.org β€Ί project β€Ί rich-color-ext
rich-color-ext Β· PyPI
Extend Rich with the ability to parse CSS color names and 3-digit hex colors.
Find elsewhere
🌐
Medium
medium.com β€Ί @jainsnehasj6 β€Ί a-practical-guide-to-rich-12-ways-to-instantly-beautify-your-python-terminal-3a4a3434d04a
A Practical Guide to Rich: 12 Ways to Instantly Beautify Your Python Terminal | by Sneha Jain | Medium
June 26, 2025 - Welcome back to the series where we explore Python libraries that not only solve real problems but make your code a joy to work with. Today, we’re diving into Rich β€” a Python library that brings color, formatting, tables, progress bars, and more to your terminal.
🌐
YouTube
youtube.com β€Ί watch
How to Use the Rich library for colorful Python command-line interfaces - YouTube
Command-line applications written in Python don't have to look drab and minimal. The rich library for Python lets you design textual interfaces with eye-catc...
Published: January 9, 2024
🌐
Rich
rich.readthedocs.io β€Ί en β€Ί stable β€Ί reference β€Ί color.html
rich.color β€” Rich 14.1.0 documentation
Type of color stored in Color class. rich.color.blend_rgb(color1, color2, cross_fade=0.5)[source]
🌐
Typer
typer.tiangolo.com β€Ί tutorial β€Ί printing
Printing and Colors - Typer
But in most of the cases you wouldn't need it, as in modern Python strings (str) already support and use Unicode, and you would rarely deal with pure bytes that you want to print on the screen. If you have some bytes objects, you would probably want to decode them intentionally and directly before trying to print them. And if you want to print data with colors and other features, you are much better off with the more advanced tools in Rich.
🌐
YouTube
youtube.com β€Ί watch
Python Rich Module Beautiful Terminal Colors - YouTube
Today we tried the Python Rich library, which is basically a fancy way to make your terminal look good. We pulled up the GitHub repo, installed it with pip i...
Published: January 29, 2026
Views: 0
🌐
Medium
medium.com β€Ί @ahmedharabi β€Ί get-started-with-the-python-rich-library-2736b1b57941
Get Started with the Python rich Library | by Ahmed Harabi | Medium
July 4, 2024 - It supports rich text formatting, ... illustrate how you can use rich to enhance terminal output. rich allows you to add colors and styles to your terminal text easily....
🌐
Ewels
ewels.github.io β€Ί rich-codex β€Ί config β€Ί colours
Colours - rich-codex
This uses a Python pty pseudo-terminal instead of subprocess which may trick your tool into keeping coloured output. ... Note that PTY almost certainly won't work on Windows and is generally more likely to do weird stuff / create poorly formatted outputs than the default subprocess shell. You can customise the theme using --terminal-theme / $TERMINAL_THEME / terminal_theme (CLI, env, action/config). Themes are taken from Rich...
🌐
freeCodeCamp
freecodecamp.org β€Ί news β€Ί use-the-rich-library-in-python
How to Use the Rich Library with Python
February 8, 2022 - In this article, we'll learn about a powerful library for Python called Rich. Rich is a Python library for writing rich text (with color and style) to the terminal. It lets you display advanced content such as tables, markdown, and ...
🌐
JetBrains
youtrack.jetbrains.com β€Ί projects β€Ί PY β€Ί issues β€Ί PY-59480 β€Ί Python-Rich-library-cannot-output-colors-in-Python-Console
Python Rich library cannot output colors in Python Console : PY-59480
Hi! any news regarding "emulating terminal" for the "Python Console" tool? (not for running or debugging a project file!). That will solve the issue with Β΄richΒ΄lib displaying colors in the "Python Console"!
🌐
Reddit
reddit.com β€Ί r/python β€Ί python rich - my favorite way to add colors, emojis, tables and more...
r/Python on Reddit: Python Rich - My favorite way to add Colors, Emojis, Tables and More...
February 1, 2021 - Long time Python user here and I only recently came across the module "Rich". Honestly I don't know how I made it this far without the module. Not only is it really cool for making your output look a lot better with colored formatting but the features like "inspect" really help you dive into Python objects and help the Learning Process.
🌐
Real Python
realpython.com β€Ί python-rich-package
The Python Rich Package: Unleash the Power of Console Text – Real Python
July 3, 2026 - Rich is a powerful library for constructing text-based user interfaces (TUIs) using Python. With it, you can make your code more readable by pretty-printing complex data structures, and you can make your app more attractive for your user with colored and formatted text, tables, animations, and more.