Skip to main content

Gradpyent, a Python Gradient Generator

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.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 gradpyent 0.10.0
File Size Uploaded
gradpyent-0.10.0.tar.gz 12.1 kB Details

Built distribution (wheel)

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

Total release size: 21.7 kB

Release files / gradpyent-0.10.0.tar.gz

Download URL gradpyent-0.10.0.tar.gz
Size 12.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a2de85987a6d4ae9bf703462b7d7a278fe979d81850555d67245f8059320ed1b
BLAKE2b-256 checksum
How to use checksums
a284187da8373aeed2d4d3b57bc046f893ec1813160a4ea248bebd99d253919a
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 25, 2026.

Transparency log

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

Download URL gradpyent-0.10.0-py3-none-any.whl
Size 9.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8fb11b053046445701a1ce98d47165813f1754ad940de2b8b2cb001c15e0482e
BLAKE2b-256 checksum
How to use checksums
3c66c05e4351cc9b407e88a089383f73021fbc0d4155bd45b57c8bf9cb9e29b6
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 25, 2026.

Transparency log

Release history Release notifications | RSS feed

0.10.1

2 release files

This release

0.10.0 This release

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