Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

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.

Metadata

Release files for ColorFlow 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ColorFlow 2.0.0
File Size Uploaded Provenance Actions
colorflow-2.0.0.tar.gz 16.8 kB With provenance Details for colorflow-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ColorFlow 2.0.0
File Interpreter ABI Platform Actions
colorflow-2.0.0-py3-none-any.whl Python 3 none any Details for colorflow-2.0.0-py3-none-any.whl

Total release size: 24.8 kB

Release files / colorflow-2.0.0.tar.gz

Download URL colorflow-2.0.0.tar.gz
Size 16.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a1584ffbac7c0326ac490accf0ef83f0c482bb1ab2357edaeee831d467572781
BLAKE2b-256 checksum
How to use checksums
64ca7e8e209eaf782703c00407ad0fec6711307f6f2ee5d0ec45ea7bf07b9736
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 7, 2024.

Transparency log

Release files / colorflow-2.0.0-py3-none-any.whl

Download URL colorflow-2.0.0-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
531430016bd020ce2f5d278dae3d18b526af3db8370125d47f817cc8bbdf608b
BLAKE2b-256 checksum
How to use checksums
915d073526e1f214e0cd2656af81f74520a0e9d46820a5e22817e464ef99509f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 7, 2024.

Transparency log

Security for ColorFlow 2.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for colorflow-2.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 7, 2024.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page