Skip to main content

a small, multi-use color library for python that supports RGB, Hexadecimal, Decimal, CMYK and most web colors

Project description

pyspectrum

a small, multi-use color library for python

supports RGB, Hexadecimal, Decimal, CMYK, HSV and most web colors (red, seagreen, yellow)

Quickstart

Installation & Upgrading

Using pip to install is highly reccomended

pip install -U pyspectrum

Upgrade to the latest stable version

pip install -U --upgrade pyspectrum

Example

import pyspectrum
# init colors
c = pyspectrum.Colors()
# creating color classes out of values
redRGB = c.RGB(255, 0, 0)
redHex = c.Hexadecimal("#ff0000")
redCMYK = c.CMYK(0, 100, 100, 0)
# html/css color name
convertedRGB = c.from_name("red")
# converting values
convertedCMYK = redRGB.to_cmyk()
convertedHex = redRGB.to_hex()
# accessing tuples and printing
print(f"Red RGB tuple: {redRGB.to_tuple()}")
print(f"Red Hex code: {redHex.to_string()}")
print(f"Red CMYK tuple: {redCMYK.to_tuple()}")
## printing colored text from RGB 
# prints'This is red text' in a red color
print(c.color_text("This is red text", redRGB))

## Combining Colors
# making green
g = c.mix_colors([
    #yellow
    c.RGB(255, 255, 0),
    # blue
    c.RGB(0, 0, 255)
])
print(g.to_tuple())

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

pyspectrum-0.1.5.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyspectrum-0.1.5-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file pyspectrum-0.1.5.tar.gz.

File metadata

  • Download URL: pyspectrum-0.1.5.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.5.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for pyspectrum-0.1.5.tar.gz
Algorithm Hash digest
SHA256 6e3c53050ff4dade53eabdb26e2b2fe6984e359a20a63f642c558cd9c0036d2b
MD5 6d90177324f5e272422b750728c83b17
BLAKE2b-256 fcbab585d09558d753e9337f0e445452c0cc1b6b23f8bdccf4ce6779448a38c8

See more details on using hashes here.

File details

Details for the file pyspectrum-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: pyspectrum-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.5.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for pyspectrum-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 a75aa8f2b6f4afa3761b7a07b7be4e36ddbbb73c4dcf2886b11c946d66e2f1af
MD5 7b6f031577f21971201089b362390dec
BLAKE2b-256 dc44d36f1a6107fccd43c566492e762f3cb6d28104b9204151f7adb786773f12

See more details on using hashes here.

Supported by

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