Skip to main content

A Python package for generating shades of a color

Project description

Color Shade Generator

Color Shade Generator is a Python package that allows you to easily generate a list of shades for a given color. The package can generate shades in both hexadecimal and RGB format.


You can install the package using pip:

pip install python-colorcode==0.1


The package provides a single function called generate_color_shades() which takes in two parameters:

color_name: the name of the color for which you want to generate shades. The color name should be a string that is recognized by the webcolors library. rgb (optional): a boolean value that indicates whether the shades should be returned in RGB format (True) or hex format (False). The default value is False. Here is an example of how to use the generate_color_shades() function:

from python-colorcode import python_colorcode

    hex_shades = python_colorcode.generate_color_shades("red")

    rgb_shades = python_colorcode.generate_color_shades("red", rgb=True)
except ValueError as e:

The above code will generate 20 shades of the color red, in hex and RGB format, respectively. If the color name passed is not valid, it will raise a ValueError.


This package is using webcolors library to convert color name to RGB, it supports all the CSS3 standard color names, you can find the full list here

Also, you can add more functionality like,

ability to return the shades in different format like HSL or HSV. ability to return the shades in the order of Lightest to Darkest or vice versa. etc.


If you would like to contribute to the package, please submit a pull request.


This package is licensed under the MIT License.


This package is using webcolors library, you can find more information about it here

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python-colorcode-0.4.tar.gz (2.8 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page