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 yulm-styled 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.1.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.1-py3-none-any.whl (2.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: yulm-styled-1.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 a6a895f0a673733534b39669da17d3fc8d920b4064815a6289ac4ca6fbe7a4cb
MD5 821d6e804dcb9c4bc723760286d218a7
BLAKE2b-256 7d36ca3a5d80eca6dc549f80396d00ab6a85fb46a498b93f9109804a51be2a91

See more details on using hashes here.

File details

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

File metadata

  • Download URL: yulm_styled-1.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6f3fd8045c70a6d9dc36d1b8098c14709488850344c7516b0f30af49ad405b8d
MD5 97d0a620b20195a386c82511f1032807
BLAKE2b-256 adf73ecb6e273a9ef338f7a41f3926077bc3fa4d0f964a40d31bd9e7bea6c4b4

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