Skip to main content

A Python library for creating and applying full-color, linear, and circular gradients to text with easy color management.

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

ColorFlow

A Python library for creating stunning color gradients, including full-color, and applying them to text. It supports both linear and circular gradients with comprehensive color management tools.

Installation

Install ColorFlow using pip:

pip install colorflow

Color Layers

ColorFlow introduces flexible color layer control, allowing developers to apply colors to text with precision. Developers can choose to color the foreground text, background, or both simultaneously.

from colorflow import Presets, ColorLayer

blue = Presets.Blue

# Foreground coloration (default behavior)
print(blue("Blue Text", layer=ColorLayer.FOREGROUND))

# Background coloration
print(blue("Blue Background", layer=ColorLayer.BACKGROUND))

# Comprehensive color application
print(blue("Blue Everywhere", layer=ColorLayer.BOTH))

Color Creation Methods

The library supports multiple color generation techniques, enabling developers to create colors through various input formats.

from colorflow import FromRGB, FromHTML, FromHSL

# RGB color generation
custom_blue = FromRGB(0, 0, 255)

# HTML hex code parsing
web_red = FromHTML("#FF0000")

# HSL color conversion
pastel_green = FromHSL(120, 0.5, 0.6)

# Maybe i'll had more conversions.

Color Presets

ColorFlow provides a comprehensive collection of predefined colors, simplifying color selection for developers.

from colorflow import Presets

blue = Presets.Blue
red = Presets.Red
green = Presets.Green

Gradient Generation

The library supports both linear and radial color gradients, enabling sophisticated text color transitions.

Linear Gradient

from colorflow import ColorSequence, Presets, GradientType, ColorLayer

gradient = ColorSequence({
    0: Presets.Blue, 
    1: Presets.Red
}, gradient_type=GradientType.LINEAR)

print(gradient("Smooth color transition", layer=ColorLayer.FOREGROUND))

Radial Gradient

angular_gradient = ColorSequence({
    0: Presets.Blue,
    0.5: Presets.White,
    1: Presets.Red
}, gradient_type=GradientType.RADIAL)

print(angular_gradient("Radial color spread", layer=ColorLayer.FOREGROUND))

Advanced Color Mapping

Developers can create complex color mappings, assigning unique colors to individual characters.

from colorflow import MapCharsToColors, Presets, ColorLayer

mapper = MapCharsToColors({
    'h': Presets.Red,
    'e': Presets.Green,
    'l': Presets.Blue,
    'o': Presets.Purple
}, layer=ColorLayer.BOTH)

print(mapper("hello"))

Random Color Generation

ColorFlow offers random color generation with optional color palette constraints.

from colorflow import RandomColor, Presets

random_color = RandomColor()  # Completely random
specific_colors = RandomColor([Presets.Red, Presets.Green, Presets.Blue])

Coordinate System

Gradient coordinates are normalized between (0, 0) and (1, 1):

  • (0, 0) represents the top-left corner
  • (1, 1) represents the bottom-right corner
  • (0.5, 0.5) indicates the center point

License

Distributed under the MIT License.

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

colorflow-2.0.0.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

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

colorflow-2.0.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file colorflow-2.0.0.tar.gz.

File metadata

  • Download URL: colorflow-2.0.0.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for colorflow-2.0.0.tar.gz
Algorithm Hash digest
SHA256 a1584ffbac7c0326ac490accf0ef83f0c482bb1ab2357edaeee831d467572781
MD5 4859a9d43cc3e40102360a9e907c2cc1
BLAKE2b-256 64ca7e8e209eaf782703c00407ad0fec6711307f6f2ee5d0ec45ea7bf07b9736

See more details on using hashes here.

Provenance

The following attestation bundles were made for colorflow-2.0.0.tar.gz:

Publisher: release.yaml on Pcoi94/ColorFlow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file colorflow-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: colorflow-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for colorflow-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 531430016bd020ce2f5d278dae3d18b526af3db8370125d47f817cc8bbdf608b
MD5 45102065d0f1b09d1ee541d6e120038e
BLAKE2b-256 915d073526e1f214e0cd2656af81f74520a0e9d46820a5e22817e464ef99509f

See more details on using hashes here.

Provenance

The following attestation bundles were made for colorflow-2.0.0-py3-none-any.whl:

Publisher: release.yaml on Pcoi94/ColorFlow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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