Skip to main content

library for a colorful terminal!

Project description

Iridis

This library provides functions to print styled text in the console, with support for color-coded messages and rainbow text effects.

Color Enum

The Color enum defines various color codes that can be used with the functions below.

from enum import Enum

class Color(Enum):
    RED = "\033[91m"
    GREEN = "\033[92m"
    YELLOW = "\033[93m"
    BLUE = "\033[94m"
    PURPLE = "\033[95m"
    # Additional colors available (e.g., BRIGHT, BG colors)

Functions

print_with_color(*values: object, color: Color)

Prints the given values in the specified color.

  • values: Objects to print.
  • color: Color enum specifying the text color.

Example:

print_with_color("Hello, World!", color=Color.BLUE)

print_error(*values: object)

Prints the values in red to indicate an error.

  • values: Objects representing the error message.

Example:

print_error("This is an error message.")

print_title(*values: object)

Prints the values in green to indicate a title or header.

  • values: Objects representing the title text.

Example:

print_title("Welcome to the Application")

print_rainbow(*values: object)

Prints the values with a rainbow color effect.

  • values: Objects to print with each character in a different color.

Example:

print_rainbow("This text is in rainbow colors!")

get_number_from_user(input_text: str, error_message: str, conditions: list) -> float

Prompts the user for a number and validates it against optional conditions.

  • input_text: Prompt text (default: "Vložte číslo:").
  • error_message: Error message shown if input is invalid (default: "Špatný vstup, zkuste znova!").
  • conditions: List of boolean lambda conditions to validate the input.

Example:

get_number_from_user("Enter a number: ", "Invalid input!", conditions=[lambda x: x > 0])

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

iridis-0.1.4.tar.gz (3.1 kB view details)

Uploaded Source

File details

Details for the file iridis-0.1.4.tar.gz.

File metadata

  • Download URL: iridis-0.1.4.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for iridis-0.1.4.tar.gz
Algorithm Hash digest
SHA256 20862d9219d4aa503fd5c8b97fbe9d7f6b2f3ece71d4e9b6a307073b84b32392
MD5 8408fa1dd51a75de6d45f9defd74e0fc
BLAKE2b-256 2f8387dc06424574b8560abb1851ed54ab066dc011e818368d40815c1d95075c

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