Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

tonetext

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tonetext

Colored text for terminal

pipPyPI
Version
0.2.1
Maintainers
1

Tone Text

Output colored text to the terminal using Python

Setup and Installation

Using pip

pip install tonetext

Or upgrade current version:

pip install --upgrade tonetext

Example

Foreground

from tonetext import colored

print(colored("This is red text", color="red"))

Or

from tonetext import cprint

cprint("Hello there", color="green")

Foreground and Background

from tonetext import colored

print(colored("Green on white", color="green", on_color="white"))

Or

from tonetext import cprint

cprint("Red on black", color="red", on_color="black")

Styling

underline & italic are not supported on windows

from tonetext import italic, underline, bold

print(italic("This is italic"))
print(underline("This is underlined"))
print(bold("This is bold"))

Styling with Foreground and Background

from tonetext import colored, italic, underline, bold

print(
    underline("This is red on white",
    color="red",
    on_color="white")
)

print(
    italic("This is italic",
    color="green")
)

Specific Use Cases

These method prints by default & return None

from tonetext import warn, error, info, success

warn("This is warning") # yellow bold text
info("This is to inform") # blue bold text
success("Success", strong=False) # green normal text
error("Error: File Missing") # red bold text

Horizontal Line (width equal to terminal width)

from tonetext import line

line()  # a horizontal line
line(text="Hello")  # horizontal line with text in middle
line(text="Hello", color="red") # red color line with text in middle
help(line)  # for more info

Available Colors and Styles

Foreground(color)Background(on_color)
BlackGrey
RedRed
GreenGreen
YellowYellow
BlueBlue
MagentaMagenta
CyanCyan
WhiteWhite
StyleBoldItalicUnderline
FunctionParametersUse for
coloredtext, color, on_colorColored text
italictext, color, on_colorItalic colored text
underlinetext, color, on_colorUnderlined colored text
boldtext, color, on_colorBold colored text
warntextYellow Bold Warning text
errortextRed Bold Error text
infotextBlue Bold Information text
successtextGreen Bold Success text

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts