PyColor
A python collection of classes and functions to convert between rgb, hsv, hsl, xyz, ycc, cmyk and hex color formats and generate palettes from said colors.
- RGB (red, green, blue)
- HSV (hue, saturation, value)
- HSL (hue, saturation, lightness)
- XYZ (x, y, z)
- YCC (y, cb, cr)
- CMYK (cyan, magenta, yellow, key)
- HEX (hexidecimal)
Installation
With git GitHub:
git clone https://github.com/IrtsaDevelopment/PyColor.git
or with pip PyPi:
pip install idev-pycolor
Usage
To import, simply put:
from PyColor.Colors import *
from PyColor.Functions import *
from PyColor.Palettes import GeneratePalette
Then, later on you may utilize:
rgb = RGB(100, 100, 100)
hsv = HSV(200, 100, 100)
hsl = HSL(200, 100, 100)
xyz = XYZ(10.0, 10.0, 80.0)
ycc = YCC(100.0, 150.0, 80.0)
cmyk = CMYK(100, 100, 100, 100)
hexidecimal = HEX("#121212")
rgb.rgb
# Returns a tuple of the rgb values from rgb.
rgb.hsv
# Returns a tuple of the hsv values from rgb.
rgb.hsl
# Retuns a tuple of the hsl values from rgb.
rgb.xyz
# Returns a tuple of the xyz values from rgb.
rgb.ycc
# Returns a tuple of the ycc values from rgb.
rgb.cmyk
# Returns a tuple of the cmyk values from rgb.
rgb.hexidecimal
# Returns a string of the hexidecimal value from rgb.
rgb.percentForm
# Returns a tuple of the rgb values in a decimal percent form (0-1).
rgb.grayscale
# Returns a grayscaled version of the RGB class.
rgb.greyscale
# Is .grayscale
hsv.rgb
# Returns a tuple of the rgb values from hsv.
hsv.hsv
# Returns a tuple of the hsv values from hsv.
hsv.hsl
# Retuns a tuple of the hsl values from hsv.
hsv.xyz
# Returns a tuple of the xyz values from hsv.
hsv.ycc
# Returns a tuple of the ycc values from hsv.
hsv.cmyk
# Returns a tuple of the cmyk values from hsv.
hsv.hexidecimal
# Returns a string of the hexidecimal value from hsv.
hsv.percentForm
# Returns a tuple of the hsv values in a decimal percent form (0-1).
hsv.grayscale
# Returns a grayscaled version of the HSV class.
hsv.greyscale
# Is .grayscale
hsl.rgb
# Returns a tuple of the rgb values from hsl.
hsl.hsv
# Returns a tuple of the hsv values from hsl.
hsl.hsl
# Retuns a tuple of the hsl values from hsl.
hsl.xyz
# Returns a tuple of the xyz values from hsl.
hsl.ycc
# Returns a tuple of the ycc values from hsl.
hsl.cmyk
# Returns a tuple of the cmyk values from hsl.
hsl.hexidecimal
# Returns a string of the hexidecimal value from hsl.
hsl.percentForm
# Returns a tuple of the hsl values in a decimal percent form (0-1).
hsl.grayscale
# Returns a grayscaled version of the HSL class.
hsl.greyscale
# Is .grayscale
xyz.rgb
# Returns a tuple of the rgb values from xyz.
xyz.hsv
# Returns a tuple of the hsv values from xyz.
xyz.hsl
# Retuns a tuple of the hsl values from xyz.
xyz.xyz
# Returns a tuple of the xyz values from xyz.
xyz.ycc
# Returns a tuple of the ycc values from xyz.
xyz.cmyk
# Returns a tuple of the cmyk values from xyz.
xyz.hexidecimal
# Returns a string of the hexidecimal value from xyz.
xyz.percentForm
# Returns a tuple of the xyz values in a decimal percent form (0-1).
xyz.grayscale
# Returns a grayscaled version of the XYZ class.
xyz.greyscale
# Is .grayscale
ycc.rgb
# Returns a tuple of the rgb values from ycc.
ycc.hsv
# Returns a tuple of the hsv values from ycc.
ycc.hsl
# Retuns a tuple of the hsl values from ycc.
ycc.xyz
# Returns a tuple of the xyz values from ycc.
ycc.ycc
# Returns a tuple of the ycc values from ycc.
ycc.cmyk
# Returns a tuple of the cmyk values from ycc.
ycc.hexidecimal
# Returns a string of the hexidecimal value from ycc.
ycc.percentForm
# Returns a tuple of the ycc values in a decimal percent form (0-1).
ycc.grayscale
# Returns a grayscaled version of the YCC class.
ycc.greyscale
# Is .grayscale
cmyk.rgb
# Returns a tuple of the rgb values from cmyk.
cmyk.hsv
# Returns a tuple of the hsv values from cmyk.
cmyk.hsl
# Retuns a tuple of the hsl values from cmyk.
cmyk.xyz
# Returns a tuple of the xyz values from cmyk.
cmyk.ycc
# Returns a tuple of the ycc values from cmyk.
cmyk.cmyk
# Returns a tuple of the cmyk values from cmyk.
cmyk.hexidecimal
# Returns a string of the hexidecimal value from cmyk.
cmyk.percentForm
# Returns a tuple of the cmyk values in a decimal percent form (0-1).
cmyk.grayscale
# Returns a grayscaled version of the CMYK class.
cmyk.greyscale
# Is .grayscale
hexidecimal.rgb
# Returns a tuple of the rgb values from hexidecimal.
hexidecimal.hsv
# Returns a tuple of the hsv values from hexidecimal.
hexidecimal.hsl
# Retuns a tuple of the hsl values from hexidecimal.
hexidecimal.xyz
# Returns a tuple of the xyz values from hexidecimal.
hexidecimal.ycc
# Returns a tuple of the ycc values from hexidecimal.
hexidecimal.cmyk
# Returns a tuple of the cmyk values from hexidecimal.
hexidecimal.hexidecimal
# Returns a string of the hexidecimal value from hexidecimal.
hexidecimal.percentForm
# Returns a decimal percent form (0-1) of the hexidecimal value.
hexidecimal.grayscale
# Returns a grayscaled version of the HEX class.
hexidecimal.greyscale
# Is .grayscale
print(rgb)
# Will print off a string representation of the rgb values.
print(hsv)
# Will print off a string representation of the hsv values.
print(hsl)
# Will print off a string representation of the hsl values.
print(xyz)
# Will print off a string representation of the xyz values.
print(ycc)
# Will print off a string representation of the ycc values.
print(cmyk)
# Will print off a string representation of the cmyk values.
print(hexidecimal)
# Will print off a string representation of the hexidecimal value
GeneratePalette(RGB(100, 100, 100), 'triad')
# Will generate a palette in the form of a list of colors in the same type of class given using the scheme provided.
Interpolate([RGB(100, 100, 100), RGB(150, 150, 150)])
# Will interpolate colors that should go in between the ones given and return as a list of RGB objects.
InterpolateFormat([HSV(320, 50, 100), HSV(150, 100, 60)])
# Will interpolate colors that should go in between the ones given and return a list of color objects similar to the provided ones.
Code Examples
from PyColors.Colors import *
color = RGB(120, 140, 180)
print("The HSV values for the RGB values of " + str(color.rgb) + " are " + str(color.hsv))
from PyColors.Colors import *
from PyColors.Palettes import GeneratePalette
mainColor = HSV(320, 50, 100)
Palette = GeneratePalette(mainColor, "splitcomplimentary")
print("Palette: ")
for color in Palette: print(color)
from random import randint
from PyColors.Colors import *
Colors = [RGB(randint(0, 255), randint(0, 255), randint(0, 255)) for i in range(10)]
print("Random color RGB values:")
for color in Colors: print(color)
Additional Notes
The following are the currently supports schemes for the GeneratePalette function:
- monochromatic
- analogous
- complimentary
- splitcomplimentary
- tetrad
- triad
- random
Metadata
Release files for idev-pycolor 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| idev_pycolor-1.1.1.tar.gz | 11.8 kB | Without provenance | Details for idev_pycolor-1.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| idev_pycolor-1.1.1-py3-none-any.whl | Python 3 | none | any | Details for idev_pycolor-1.1.1-py3-none-any.whl |
Total release size: 22.3 kB
Release files / idev_pycolor-1.1.1.tar.gz
| Download URL | idev_pycolor-1.1.1.tar.gz |
|---|---|
| Size | 11.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
15177cb8fbb98ae97ede6340fddbb650a24cbc82ae1d12e21676fbda7018a4a6
|
|
BLAKE2b-256 checksum How to use checksums |
db9d63e770cc62c41c96dd6c5cf51c8ab97e6dec48f311247c39026721f79777
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.4
|
Release files / idev_pycolor-1.1.1-py3-none-any.whl
| Download URL | idev_pycolor-1.1.1-py3-none-any.whl |
|---|---|
| Size | 10.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
43b0e8859b9a65f7a80b121863349ef26d8fb0dfb44c01ff57ed4e640730909f
|
|
BLAKE2b-256 checksum How to use checksums |
dda36cf302e3e3ce285afc0728bd5b74d7307cfc5df9197cb611ea0244004a28
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.4
|
Security for idev-pycolor 1.1.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.