Skip to main content

Python color getter (being able to get random/complementary/lighter/darker color, convert between rgb/hex)

Project description

colorgetter

Python color getter (being able to get random/complementary/lighter/darker color, convert between rgb/hex)

Setup

python -m pip install python-color-getter

Method Overview

  • get_random_color() -> tuple

  • get_color_from_stylesheet(code: str) -> None

  • get_comp_color(r: int, g: int, b: int) -> tuple

  • rgb_to_hex(r: int, g: int, b: int, digit_cnt: int = 6) -> str - Argument digit_cnt is digit count of hex color user want to get. The value of digit_cnt should be 3 or 6. It is set to 6 by default.

  • hex_to_rgb(hex: str) -> tuple - Argument hex should be 3 or 6 digit hex colors like #DDD, #ABABAB.

  • lighter(r: int, g: int, b: int) -> tuple

  • darker(r: int, g: int, b: int) -> tuple

Example

Code Sample

print(get_random_color())

print(get_comp_color(255, 0, 0))

print(hex_to_rgb('#2c2c2c'))

r, g, b = 44, 44, 44

print(rgb_to_hex(r, g, b))

light_r, light_g, light_b = lighter(r, g, b)

print(rgb_to_hex(light_r, light_g, light_b))

dark_r, dark_g, dark_b = darker(r, g, b)

print(rgb_to_hex(dark_r, dark_g, dark_b))

Result


(211, 195, 123)

(0, 255, 255)

(44, 44, 44)

#2c2c2c

#3d3d3d

#1b1b1b

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

colorgetter-0.0.2.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

colorgetter-0.0.2-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file colorgetter-0.0.2.tar.gz.

File metadata

  • Download URL: colorgetter-0.0.2.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/0.0.0 CPython/3.7.6

File hashes

Hashes for colorgetter-0.0.2.tar.gz
Algorithm Hash digest
SHA256 42b6b61786f57e836df4531a646818423bc3b9367bd515a695c823826e57d1a4
MD5 a7ff8d221376c7e4682c977ba1bcebc8
BLAKE2b-256 12a3f816de8b824a8f5a29a3a4f55ae3af2846ae4433486df0d6d639a7000412

See more details on using hashes here.

File details

Details for the file colorgetter-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: colorgetter-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/0.0.0 CPython/3.7.6

File hashes

Hashes for colorgetter-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2ea2a3b9614b3c95bd868afaaf2e3784c19ce0c90be9b0b8518dcbed8d06e129
MD5 5f37059bd54229f734166d384b7ddeb3
BLAKE2b-256 ee84644f4be535bc8584e52e28c2ab7a64dd5029acefd7671592380b79d3e8a4

See more details on using hashes here.

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