Skip to main content

python-color-getter

Python color getter (including method to get random color or complementary color)

Setup

python -m pip install python-color-getter

Method Overview

  • get_random_color() -> tuple

  • get_color_from_stylesheet(code: str) -> None

  • get_complementary_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(PythonColorGetter.get_random_color())

print(PythonColorGetter.get_complementary_color(255, 0, 0))

print(PythonColorGetter.hex_to_rgb('#2c2c2c'))

r, g, b = 44, 44, 44

print(PythonColorGetter.rgb_to_hex(r, g, b))

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

print(PythonColorGetter.rgb_to_hex(light_r, light_g, light_b))

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

print(PythonColorGetter.rgb_to_hex(dark_r, dark_g, dark_b))

Result


(211, 195, 123)

(0, 255, 255)

(44, 44, 44)

#2c2c2c

#3d3d3d

#1b1b1b

Metadata

Release files for python-color-getter 0.0.1

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-color-getter 0.0.1
File Size Uploaded
python-color-getter-0.0.1.tar.gz 2.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for python-color-getter 0.0.1
File Interpreter ABI Platform
python_color_getter-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 6.3 kB

Release files / python-color-getter-0.0.1.tar.gz

Download URL python-color-getter-0.0.1.tar.gz
Size 2.8 kB
Tags Source
SHA-256 checksum
How to use checksums
1b2287f7914e21b4cf7018792951e7fe0c0d0e7cf42283bfd64b2233aade14d3
BLAKE2b-256 checksum
How to use checksums
787e45e4ac016e2e44eb8cc3d8dd128135ad2e2a841a97bed5283427ce2387ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/0.0.0 CPython/3.7.6

Release files / python_color_getter-0.0.1-py3-none-any.whl

Download URL python_color_getter-0.0.1-py3-none-any.whl
Size 3.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fe1c44d202dd7171224552e98eb1e45fdd7f493d3ae815c78c97bbd9c3c50267
BLAKE2b-256 checksum
How to use checksums
01363a14037790683e5c2fa82f9630b2dd8ace499e7fe0e41971f83e810c7059
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/0.0.0 CPython/3.7.6

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

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