Skip to main content

A package for colorizing and styling text

Project description

yulm-styled

This Python module provides utilities for colorizing text with various effects such as faded colors and rainbow colors.

Usage

To use this module, import it into your Python script:

import sys
import time
from colorized_text import Color, FadedColor, RainbowColor, colorize_text, fade_text, rainbow_text, fade_color

Colorizing Text

To colorize a text with a specific color, use the colorize_text function:

colored_text = colorize_text("Hello, World!", Color.RED)
print(colored_text)

Output:

Hello, World! (with the color)

Faded Text

To apply faded color to a text, use the fade_text function:

faded_text = fade_text("Hello, World!", FadedColor.YELLOW)
print(faded_text)

Output:

Hello, World! (Faded out Color)

Rainbow Text

To apply rainbow color to a text, use the rainbow_text function:

rainbow_text = rainbow_text("Hello, World!")
print(rainbow_text)

Output:

Hello, World! (Rainbow Colors)

Fading Color

To fade the color of a text from one color to another, use the fade_color function:

fade_color("Hello, World!", "RED", "BLUE", duration=2.0)

Output:

Hello, World! (From Red to Blue in a nice gradiend)

Color Class

The Color class provides ANSI escape codes for standard text colors. It includes the following color constants:

  • Color.RESET
  • Color.BLACK
  • Color.RED
  • Color.GREEN
  • Color.YELLOW
  • Color.BLUE
  • Color.MAGENTA
  • Color.CYAN
  • Color.WHITE
  • Color.GRAY

FadedColor Class

The FadedColor class provides ANSI escape codes for faded text colors. It includes the following color constants:

  • FadedColor.BLACK
  • FadedColor.RED
  • FadedColor.GREEN
  • FadedColor.YELLOW
  • FadedColor.BLUE
  • FadedColor.MAGENTA
  • FadedColor.CYAN
  • FadedColor.WHITE
  • FadedColor.GRAY

RainbowColor Class

The RainbowColor class provides ANSI escape codes for rainbow text colors. It includes the following method:

  • RainbowColor.get_color(index): Returns the ANSI escape code for the color at the specified index in the rainbow sequence.

fade_color Function

The fade_color function fades the specified text from left to right with a gradual color change. The user can specify the color names (e.g., "RED", "BLUE"). The number of steps is calculated based on the duration.

fade_color(text, from_color_name, to_color_name, duration=1.0)
  • text: The text to be faded.
  • from_color_name: The name of the starting color.
  • to_color_name: The name of the ending color.
  • duration: The duration of the fade animation in seconds (default: 1.0).

License

This module is released under the MIT License. See LICENSE for more information.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yulm-styled-1.0.0.tar.gz (2.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yulm_styled-1.0.0-py3-none-any.whl (2.1 kB view details)

Uploaded Python 3

File details

Details for the file yulm-styled-1.0.0.tar.gz.

File metadata

  • Download URL: yulm-styled-1.0.0.tar.gz
  • Upload date:
  • Size: 2.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.4

File hashes

Hashes for yulm-styled-1.0.0.tar.gz
Algorithm Hash digest
SHA256 79927f80ee975bc25196f2331dc409d5c2054569b7b03aff9cc07a92abb0ea1d
MD5 ca8244608a5ebb645bcb63d6879af8ff
BLAKE2b-256 7658e5a13eab457feb4d2bf2ac09a4ca1c4a451f7787760f3f7122c293f425d4

See more details on using hashes here.

File details

Details for the file yulm_styled-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: yulm_styled-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 2.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.4

File hashes

Hashes for yulm_styled-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6ef05fa17908cf4037afac5695c84c5ed9992573da81c821985be6dcbad62244
MD5 1c6aad0ed998f9cddc8b1c640195722a
BLAKE2b-256 d2f01ef5b51c3fbf8dce75891784748bc2132906017f9d3409c322d6036856ab

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page