Skip to main content

Colors for terminal styling

Project description

crgb

The crgb module provides a comprehensive set of color manipulation tools in Python. It includes a variety of static and dynamic colors, as well as functions to create and mix colors. This module is designed for developers who want to work with colors in a flexible and dynamic way.

Overview

Class: Colors

The Colors class contains:

  • 54 color variables representing different colors.
  • 3 lists:
    • static_colors: Colors that are static (e.g., 'red') and cannot be faded.
    • dynamic_colors: Colors that can be faded (e.g., 'blue_to_purple').
    • all_colors: A combination of both static and dynamic colors.

Functions

The Colors class provides the following functions:

  • StaticRGB(r: int, g: int, b: int) -> str: Create a fixed/static color using RGB values.

  • DynamicRGB(r1: int, g1: int, b1: int, r2: int, g2: int, b2: int) -> list: Create a faded/dynamic color (coming soon).

  • StaticMIX(colors: list, _start: bool = True) -> str: Mix two or more static colors.

  • DynamicMIX(colors: list): Mix two or more dynamic colors.

  • Symbol(symbol: str, col: str, col_left_right: str, left: str = '[', right: str = ']') -> str: Create a colored symbol (e.g., '[!]').

Color Variables

Dynamic Colors

  • black_to_white
  • black_to_red
  • black_to_green
  • black_to_blue
  • white_to_black
  • white_to_red
  • white_to_green
  • white_to_blue
  • red_to_black
  • red_to_white
  • red_to_yellow
  • red_to_purple
  • green_to_black
  • green_to_white
  • green_to_yellow
  • green_to_cyan
  • blue_to_black
  • blue_to_white
  • blue_to_cyan
  • blue_to_purple
  • yellow_to_red
  • yellow_to_green
  • purple_to_red
  • purple_to_blue
  • cyan_to_green
  • cyan_to_blue
  • red_to_blue
  • red_to_green
  • green_to_blue
  • green_to_red
  • blue_to_red
  • blue_to_green
  • rainbow

Static Colors

  • red
  • green
  • blue
  • white
  • black
  • gray
  • yellow
  • purple
  • cyan
  • orange
  • pink
  • turquoise
  • light_gray
  • dark_gray
  • light_red
  • light_green
  • light_blue
  • dark_red
  • dark_green
  • dark_blue
  • reset

Usage

To use the crgb module, simply import it and create colors using the provided functions. Here's an example:

from crgb import Colors

# Create a static color
static_color = Colors.StaticRGB(255, 0, 0)  # Red

# Create a dynamic color (when available)
# dynamic_color = Colors.DynamicRGB(255, 0, 0, 0, 0, 255)  # Fades from red to blue

# Mix static colors
mixed_static = Colors.StaticMIX([Colors.red, Colors.blue])

# Create a colored symbol
colored_symbol = Colors.Symbol('!', Colors.red, Colors.white)

Installation

To install the crgb module, simply clone the repository or download the module file and include it in your project.

Contributing

Contributions are welcome! If you have suggestions for improvements or new features, feel free to open an issue or submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

crgb-1.0.2.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

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

crgb-1.0.2-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file crgb-1.0.2.tar.gz.

File metadata

  • Download URL: crgb-1.0.2.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for crgb-1.0.2.tar.gz
Algorithm Hash digest
SHA256 ca2e4d9478b2e789be29d83172b3f70d715ab153cc0795b25de6050e16619656
MD5 82989c34bd26d46d0df9508398056a33
BLAKE2b-256 c0ca8a3221dd7b3dec945e53e445ffc98a873e48e6c13a7e03ad04c47bdd1071

See more details on using hashes here.

File details

Details for the file crgb-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: crgb-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for crgb-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f049003f63db8cd201c74706804f9587446b20c31e8ff607143e729d99efd423
MD5 1e41ba31c8e6dd5f14d92ec774cd5791
BLAKE2b-256 3ab86e33bb5c1dee12cd3e29805539de8c69b62057b1db57724d9deab7893610

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