ColorFlow


NameColorFlow JSON
Version 1.0.1 PyPI version JSON
download
home_pageNone
SummaryA Python library for creating and applying full-color, linear, and circular gradients to text with easy color management.
upload_time2024-11-21 18:42:42
maintainerNone
docs_urlNone
authorPcoi94
requires_python>=3.6
licenseMIT
keywords python color flow easy cmd app manage text colour ansi terminal
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ColorFlow

**ColorFlow** is a Python library for creating stunning color gradients and applying them to text with ease. It supports both linear and circular gradients and offers comprehensive utilities for managing colors.

---

## Features

- Comprehensive **color presets**
- Create colors using **RGB**, **HSL**, or **HTML hex codes**
- Generate **linear** and **circular** gradients
- Apply gradients to multi-line text
- Support for **color interpolation**
- Works seamlessly with ANSI-supported terminals

---

## Installation

ColorFlow can be installed using pip:

```bash
pip install colorflow
```

## Quick Start

### Creating Colors

With ColorFlow, colors can be defined in multiple formats:

```py
from colorflow import FromRGB, FromHTML, FromHSL

# From RGB values
blue = FromRGB(0, 0, 255)

# From HTML Hex codes
red = FromHTML("#FF0000")
short_red = FromHTML("#F00")  # Short form is supported

# From HSL (Hue, Saturation, Lightness)
green = FromHSL(120, 1.0, 0.5)
```

### Using Presets

ColorFlow includes a rich set of predefined colors through the `Presets` class:

```py
from colorflow import Presets

blue = Presets.Blue
red = Presets.Red
white = Presets.White
```

---
### Applying Colors to Text

```py
from colorflow import Presets
color = Presets.Red # Red

# Apply the color to text
colored_text = color("Hello, World!")
print(colored_text)  # Displays "Hello, World!" in red
```

---

## Gradients

### Linear Gradients

Linear gradients allow you to transition between multiple colors across the text.

```py
from colorflow import ColorSequence, Presets

# Create a gradient from blue to red
gradient = ColorSequence({
    0: Presets.Blue,  # Blue
    1: Presets.Red    # Red
})

# Apply the gradient to text
gradient_text = gradient("""
This text will gradually
change from blue
to red
""")

print(gradient_text)
```

### Directional Control

The gradient's direction can be customized using `start` and `end` points.

```py
# Top to bottom gradient
gradient = ColorSequence({
    0: Presets.Blue,  # Blue
    1: Presets.Red    # Red
}, start=(0, 0), end=(0, 1))

# Left to right gradient
gradient = ColorSequence({
    0: Presets.Blue,  # Blue
    1: Presets.Red    # Red
}, start=(0, 0), end=(1, 0))

# Diagonal gradient
gradient = ColorSequence({
    0: Presets.Blue,  # Blue
    1: Presets.Red    # Red
}, start=(0, 0), end=(1, 1))
```

## Circular Gradients

Circular gradients radiate color patterns outward from a center point.

```py
# Create a circular gradient
circular_gradient = ColorSequence({
    0: Presets.Blue,
    0.5: Presets.White,
    1: Presets.Red
}, start=(0.5, 0.5), end=(0.5, 0.5), gradient_type="CIRCULAR")

# Apply the gradient to text
circular_text = circular_gradient("""
This text will have
a circular gradient
emanating from the center
""")

print(circular_text)
```

### Example with Input

```py
from colorflow import Presets, ColorSequence

sequence = ColorSequence({
    0: Presets.Blue,    # Blue
    0.5: Presets.White, # White
    1: Presets.Red      # Red
}, start=(0.5, 0), end=(0.5, 1), gradient_type="CIRCULAR")

input(sequence("""
██████╗  ██████╗ ██████╗ ██╗ █████╗ ██╗  ██╗
██╔══██╗██╔════╝██╔═══██╗██║██╔══██╗██║  ██║
██████╔╝██║     ██║   ██║██║╚██████║███████║
██╔═══╝ ██║     ██║   ██║██║ ╚═══██║╚════██║
██║     ╚██████╗╚██████╔╝██║ █████╔╝     ██║
╚═╝      ╚═════╝ ╚═════╝ ╚═╝ ╚════╝      ╚═╝
"""))
```

### Coordinate System

For both linear and circular gradients:

- `start` and `end` are normalized between `(0, 0)` and `(1, 1)`:
    - `(0, 0)` is the top-left corner
    - `(1, 1)` is the bottom-right corner
    - `(0.5, 0.5)` is the center

## License
This project is licensed under the MIT License. See the LICENSE file for details.#
#\x00 \x00C\x00o\x00l\x00o\x00r\x00F\x00l\x00o\x00w\x00
\x00
\x00

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "ColorFlow",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "python, color, flow, easy, cmd, app, manage, text, colour, ansi, terminal",
    "author": "Pcoi94",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/ec/93/e9c1614842b5795d8cc80a0a5bac18a96a0083d8a9aa2d4332fde6695202/colorflow-1.0.1.tar.gz",
    "platform": null,
    "description": "# ColorFlow\n\n**ColorFlow** is a Python library for creating stunning color gradients and applying them to text with ease. It supports both linear and circular gradients and offers comprehensive utilities for managing colors.\n\n---\n\n## Features\n\n- Comprehensive **color presets**\n- Create colors using **RGB**, **HSL**, or **HTML hex codes**\n- Generate **linear** and **circular** gradients\n- Apply gradients to multi-line text\n- Support for **color interpolation**\n- Works seamlessly with ANSI-supported terminals\n\n---\n\n## Installation\n\nColorFlow can be installed using pip:\n\n```bash\npip install colorflow\n```\n\n## Quick Start\n\n### Creating Colors\n\nWith ColorFlow, colors can be defined in multiple formats:\n\n```py\nfrom colorflow import FromRGB, FromHTML, FromHSL\n\n# From RGB values\nblue = FromRGB(0, 0, 255)\n\n# From HTML Hex codes\nred = FromHTML(\"#FF0000\")\nshort_red = FromHTML(\"#F00\")  # Short form is supported\n\n# From HSL (Hue, Saturation, Lightness)\ngreen = FromHSL(120, 1.0, 0.5)\n```\n\n### Using Presets\n\nColorFlow includes a rich set of predefined colors through the `Presets` class:\n\n```py\nfrom colorflow import Presets\n\nblue = Presets.Blue\nred = Presets.Red\nwhite = Presets.White\n```\n\n---\n### Applying Colors to Text\n\n```py\nfrom colorflow import Presets\ncolor = Presets.Red # Red\n\n# Apply the color to text\ncolored_text = color(\"Hello, World!\")\nprint(colored_text)  # Displays \"Hello, World!\" in red\n```\n\n---\n\n## Gradients\n\n### Linear Gradients\n\nLinear gradients allow you to transition between multiple colors across the text.\n\n```py\nfrom colorflow import ColorSequence, Presets\n\n# Create a gradient from blue to red\ngradient = ColorSequence({\n    0: Presets.Blue,  # Blue\n    1: Presets.Red    # Red\n})\n\n# Apply the gradient to text\ngradient_text = gradient(\"\"\"\nThis text will gradually\nchange from blue\nto red\n\"\"\")\n\nprint(gradient_text)\n```\n\n### Directional Control\n\nThe gradient's direction can be customized using `start` and `end` points.\n\n```py\n# Top to bottom gradient\ngradient = ColorSequence({\n    0: Presets.Blue,  # Blue\n    1: Presets.Red    # Red\n}, start=(0, 0), end=(0, 1))\n\n# Left to right gradient\ngradient = ColorSequence({\n    0: Presets.Blue,  # Blue\n    1: Presets.Red    # Red\n}, start=(0, 0), end=(1, 0))\n\n# Diagonal gradient\ngradient = ColorSequence({\n    0: Presets.Blue,  # Blue\n    1: Presets.Red    # Red\n}, start=(0, 0), end=(1, 1))\n```\n\n## Circular Gradients\n\nCircular gradients radiate color patterns outward from a center point.\n\n```py\n# Create a circular gradient\ncircular_gradient = ColorSequence({\n    0: Presets.Blue,\n    0.5: Presets.White,\n    1: Presets.Red\n}, start=(0.5, 0.5), end=(0.5, 0.5), gradient_type=\"CIRCULAR\")\n\n# Apply the gradient to text\ncircular_text = circular_gradient(\"\"\"\nThis text will have\na circular gradient\nemanating from the center\n\"\"\")\n\nprint(circular_text)\n```\n\n### Example with Input\n\n```py\nfrom colorflow import Presets, ColorSequence\n\nsequence = ColorSequence({\n    0: Presets.Blue,    # Blue\n    0.5: Presets.White, # White\n    1: Presets.Red      # Red\n}, start=(0.5, 0), end=(0.5, 1), gradient_type=\"CIRCULAR\")\n\ninput(sequence(\"\"\"\n\u2588\u2588\u2588\u2588\u2588\u2588\u2557  \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557  \u2588\u2588\u2557\n\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\u2588\u2588\u2554\u2550\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\n\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u2588\u2588\u2551     \u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\n\u2588\u2588\u2554\u2550\u2550\u2550\u255d \u2588\u2588\u2551     \u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2551 \u255a\u2550\u2550\u2550\u2588\u2588\u2551\u255a\u2550\u2550\u2550\u2550\u2588\u2588\u2551\n\u2588\u2588\u2551     \u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2554\u255d     \u2588\u2588\u2551\n\u255a\u2550\u255d      \u255a\u2550\u2550\u2550\u2550\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d \u255a\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u255d      \u255a\u2550\u255d\n\"\"\"))\n```\n\n### Coordinate System\n\nFor both linear and circular gradients:\n\n- `start` and `end` are normalized between `(0, 0)` and `(1, 1)`:\n    - `(0, 0)` is the top-left corner\n    - `(1, 1)` is the bottom-right corner\n    - `(0.5, 0.5)` is the center\n\n## License\nThis project is licensed under the MIT License. See the LICENSE file for details.#\n#\\x00 \\x00C\\x00o\\x00l\\x00o\\x00r\\x00F\\x00l\\x00o\\x00w\\x00\n\\x00\n\\x00\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A Python library for creating and applying full-color, linear, and circular gradients to text with easy color management.",
    "version": "1.0.1",
    "project_urls": null,
    "split_keywords": [
        "python",
        " color",
        " flow",
        " easy",
        " cmd",
        " app",
        " manage",
        " text",
        " colour",
        " ansi",
        " terminal"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8459ef0d4c6a750a8e049b8a020964101cc7adb7dad17ef56a8b58646de6ffff",
                "md5": "c0fff5deea28718b68bb673b95a774bc",
                "sha256": "da9663449a9a681fe6895b28789a87d6d03eba1cd26ec9cca5c26675818002a4"
            },
            "downloads": -1,
            "filename": "colorflow-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c0fff5deea28718b68bb673b95a774bc",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 7881,
            "upload_time": "2024-11-21T18:42:40",
            "upload_time_iso_8601": "2024-11-21T18:42:40.256338Z",
            "url": "https://files.pythonhosted.org/packages/84/59/ef0d4c6a750a8e049b8a020964101cc7adb7dad17ef56a8b58646de6ffff/colorflow-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ec93e9c1614842b5795d8cc80a0a5bac18a96a0083d8a9aa2d4332fde6695202",
                "md5": "366f27e0f2de4dbb553f29344f59c715",
                "sha256": "e0109e2ff2856877c797c891921a106b30b1579b38807f8059419b5f964f5d97"
            },
            "downloads": -1,
            "filename": "colorflow-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "366f27e0f2de4dbb553f29344f59c715",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 6653,
            "upload_time": "2024-11-21T18:42:42",
            "upload_time_iso_8601": "2024-11-21T18:42:42.269779Z",
            "url": "https://files.pythonhosted.org/packages/ec/93/e9c1614842b5795d8cc80a0a5bac18a96a0083d8a9aa2d4332fde6695202/colorflow-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-21 18:42:42",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "colorflow"
}
        
Elapsed time: 0.87555s