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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1584ffbac7c0326ac490accf0ef83f0c482bb1ab2357edaeee831d467572781
|
|
| MD5 |
4859a9d43cc3e40102360a9e907c2cc1
|
|
| BLAKE2b-256 |
64ca7e8e209eaf782703c00407ad0fec6711307f6f2ee5d0ec45ea7bf07b9736
|
Provenance
The following attestation bundles were made for colorflow-2.0.0.tar.gz:
Publisher:
release.yaml on Pcoi94/ColorFlow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
colorflow-2.0.0.tar.gz -
Subject digest:
a1584ffbac7c0326ac490accf0ef83f0c482bb1ab2357edaeee831d467572781 - Sigstore transparency entry: 153988852
- Sigstore integration time:
-
Permalink:
Pcoi94/ColorFlow@329afd87b6a0347ee3fb9dba9dcd0268fcfc16ce -
Branch / Tag:
refs/tags/2.0.0 - Owner: https://github.com/Pcoi94
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@329afd87b6a0347ee3fb9dba9dcd0268fcfc16ce -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
531430016bd020ce2f5d278dae3d18b526af3db8370125d47f817cc8bbdf608b
|
|
| MD5 |
45102065d0f1b09d1ee541d6e120038e
|
|
| BLAKE2b-256 |
915d073526e1f214e0cd2656af81f74520a0e9d46820a5e22817e464ef99509f
|
Provenance
The following attestation bundles were made for colorflow-2.0.0-py3-none-any.whl:
Publisher:
release.yaml on Pcoi94/ColorFlow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
colorflow-2.0.0-py3-none-any.whl -
Subject digest:
531430016bd020ce2f5d278dae3d18b526af3db8370125d47f817cc8bbdf608b - Sigstore transparency entry: 153988853
- Sigstore integration time:
-
Permalink:
Pcoi94/ColorFlow@329afd87b6a0347ee3fb9dba9dcd0268fcfc16ce -
Branch / Tag:
refs/tags/2.0.0 - Owner: https://github.com/Pcoi94
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@329afd87b6a0347ee3fb9dba9dcd0268fcfc16ce -
Trigger Event:
push
-
Statement type: