Terminal String Styling

1.1.6 · active · verified Fri Apr 17

Style is a simple and fast Python library for styling terminal output with colors and formatting using ANSI escape codes. It provides a clean API for foreground colors, background colors, and text effects. The current version is 1.1.6, and it maintains a stable, active release cadence.

Common errors

Warnings

Install

Imports

Quickstart

This example demonstrates basic usage of `style` to apply foreground color, background color, and text effects like bold or underline to a string. The `style` function returns the styled string, which can then be printed.

from style import style, fg, bg, ef

print(style("Hello, World!", fg.red, bg.blue, ef.bold))
print(style("Underlined text.", ef.underline))
print(style("Green background.", bg.green))

view raw JSON →