Skip to main content

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.

Installation

You can install the package using pip:

pip install python-colorcode==0.1

Usage

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

try:
    hex_shades = python_colorcode.generate_color_shades("red")
    print(hex_shades)

    rgb_shades = python_colorcode.generate_color_shades("red", rgb=True)
    print(rgb_shades)
except ValueError as e:
    print(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.

Note

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.

Contributing

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

License

This package is licensed under the MIT License.

Acknowledgements

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

Release files for python-colorcode 0.4

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

Source distribution (sdist)

Source distribution for python-colorcode 0.4
File Size Uploaded
python-colorcode-0.4.tar.gz 2.8 kB Details

Release files / python-colorcode-0.4.tar.gz

Download URL python-colorcode-0.4.tar.gz
Size 2.8 kB
Tags Source
SHA-256 checksum
How to use checksums
909770e4a33675f1d1557b4e41fc9964bba70ac6a6dce60828979368458b4636
BLAKE2b-256 checksum
How to use checksums
b6885fa3b0044b70b8c1757e910a070ed7024e7401762da62ba5bd412561adc6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.8

Release history Release notifications | RSS feed

This release

0.4 This release

1 release file

0.3

1 release file

0.2

1 release file

0.1

1 release file

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