Skip to main content

Gradpyent, a Python Gradient Generator

Tests PyPI version Python versions License

Gradpyent is a Python package for generating color gradients based on list-like inputs and start/end color values. The generated gradients are ideal for data visualization, user interfaces, or anywhere you want to convert a list of values into a color gradient.

This package allows you to specify colors in a variety of formats including RGB, HTML, and KML, giving you the flexibility to match your specific needs.

The gradient generation algorithm automatically scales input values outside the range of 0-1, ensuring the generated gradient remains consistent and visually pleasing.

Table of Contents

Installation

You can install Gradpyent directly from PyPI:

pip install gradpyent

Usage

Basic usage:

from gradpyent.gradient import Gradient

# Define the start and end colors as RGB, HTML, or KML
start_color = 'RGB(255,0,0)'  # Red in RGB
end_color = '#0000ff'  # Blue in HTML

# Instantiate the gradient generator, opacity is optional (only used for KML)
gg = Gradient(gradient_start=start_color, gradient_end=end_color, opacity=1.0)

# Define the input list
input_list = [0, 0.5, 1]

# Generate the gradient
gradient = gg.get_gradient_series(series=input_list, fmt='html')

print(gradient)

Examples

Here are some more examples demonstrating how to use different color formats and list inputs:

  • RGB colors:
start_color = 'rgb(255,0,0)'  # Red
end_color = 'rgb(0,0,255)'  # Blue
input_list = [0, 0.5, 1]
  • HTML colors:
start_color = '#ff0000'  # Red
end_color = '#0000ff'  # Blue
input_list = [0, 0.5, 1]
  • KML colors:
start_color = 'ff0000ff'  # Red
end_color = 'ffff0000'  # Blue
input_list = [0, 0.5, 1]
  • Scaling input values:
start_color = 'rgb(255,0,0)'  # Red
end_color = '#0000ff'  # Blue
input_list = [-5, 0, 5, 10]  # Values outside 0-1 range
  • Jupyter notebook samples:
    • See the notebooks directory for more examples
    • Install gradpyent[notebooks] for the extra dependencies the notebooks use (matplotlib, numpy, pandas)

License

This project is licensed under the terms of the BSD 3-Clause license. See the LICENSE file for details.

Code Quality

ruff format src/ tests/

ruff check src/ [--fix]

Tests

pytest --cov

Docs

sphinx-apidoc -o docs/ src/gradpyent

Enjoy the colorful world!

Metadata

Release files for gradpyent 0.10.1

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

Source distribution (sdist)

Source distribution for gradpyent 0.10.1
File Size Uploaded
gradpyent-0.10.1.tar.gz 12.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gradpyent 0.10.1
File Interpreter ABI Platform
gradpyent-0.10.1-py3-none-any.whl Python 3 none any Details

Total release size: 22.1 kB

Release files / gradpyent-0.10.1.tar.gz

Download URL gradpyent-0.10.1.tar.gz
Size 12.4 kB
Tags Source
SHA-256 checksum
How to use checksums
577cc3c7d9f03cb57f9e24622f54b30f19d76c850ba4db2a26a9b467cd1e128f
BLAKE2b-256 checksum
How to use checksums
ccf231ac6b797966aab9d98e62850d96aad85defe55a74de81d460ac90362606
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

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 Jul 26, 2026.

Transparency log

Release files / gradpyent-0.10.1-py3-none-any.whl

Download URL gradpyent-0.10.1-py3-none-any.whl
Size 9.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c7874a90d6fc1099d72e85d8b7ad1e16c6ac86abf6af41b34c0893a9be46e08e
BLAKE2b-256 checksum
How to use checksums
5c0bf9692d65d1e54e1e458672e7529f10ca2023bb51fc058ba365a7af07a9da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

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 Jul 26, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.10.1 This release

2 release files

0.10.0

2 release files

0.9.5

2 release files

0.9.4

2 release files

0.9.3

2 release files

0.2.1

2 release files

0.1.7

2 release files

0.1.4

2 release files

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