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.

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

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 details)

Uploaded Source

File details

Details for the file python-colorcode-0.4.tar.gz.

File metadata

  • Download URL: python-colorcode-0.4.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for python-colorcode-0.4.tar.gz
Algorithm Hash digest
SHA256 909770e4a33675f1d1557b4e41fc9964bba70ac6a6dce60828979368458b4636
MD5 a7434a7b9f01d20aa99e00891bb5288b
BLAKE2b-256 b6885fa3b0044b70b8c1757e910a070ed7024e7401762da62ba5bd412561adc6

See more details on using hashes here.

Supported by

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