Skip to main content

Converts back and forth between different color formats [(255,0,0),#ff0000, 16711680,(255,0,255) ... ]

pip install fabisschomagut

Tested against Windows 10 / Python 3.10 / Anaconda

How to use it

# Converting from one color format to another

from fabisschomagut import subtract_color,add_color,to_rgb_hex,to_rgba_hex,to_rgba_tuple,to_rgb_tuple

print(to_rgb_tuple(color="red"))
print(to_rgba_tuple(color=(255, 0, 0)))
print(to_rgb_hex(color="#ff0000"))
print(to_rgba_hex(color="0xFF0000"))


print(to_rgb_tuple(color=0xFF0000, invert=True))
print(to_rgba_tuple(color="red", invert=True))
print(to_rgb_hex(color="red", invert=True))
print(to_rgba_hex(color=(255, 0, 0), invert=True))


print(to_rgb_tuple(color="blue", invert=True))
print(to_rgba_tuple(color=(0, 255, 0), invert=True))
print(to_rgb_hex(color="ff0000", invert=False))
print(to_rgba_hex(color="#FFF000", invert=False))
print(to_rgb_tuple(color="BLUE", invert=False))
print(add_color(color1="BLUE", color2=(0, 255, 0), invert=False))

print(subtract_color(color1="pink", color2="#200000", invert=False))
print(to_rgb_hex(color=16746513, invert=False))

print(subtract_color(color1="pink", color2="0x200000", invert=False))
print(subtract_color(color1="ffc0cb", color2=0x200000, invert=False))
print(subtract_color(color1=0xFFC0CB, color2="#200000", invert=True))
print(to_rgb_hex(subtract_color(color1="pink", color2="200000", invert=True)))


# (255, 0, 0)
# (255, 0, 0, 255)
# 0xff0000
# (255, 0, 0, 255)
# 0xff0000ff
# #FF0000
# (0, 0, 255)
# (0, 0, 255, 255)
# 0x0000ff
# (0, 0, 255, 255)
# 0x0000ffff
# (255, 0, 0)
# (0, 255, 0, 255)
# 0xff0000
# (255, 240, 0, 255)
# 0xfff000ff
# (0, 0, 255)
# (0, 255, 255)
# (223, 192, 203)
# #FF8811
# 0xff8811
# (223, 192, 203)
# #200000
# (223, 192, 203)
# #FFC0CB
# (203, 192, 223)
# 0xcbc0df

Metadata

Release files for fabisschomagut 0.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fabisschomagut 0.11
File Size Uploaded
fabisschomagut-0.11.tar.gz 7.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fabisschomagut 0.11
File Interpreter ABI Platform
fabisschomagut-0.11-py3-none-any.whl Python 3 none any Details

Total release size: 16.2 kB

Release files / fabisschomagut-0.11.tar.gz

Download URL fabisschomagut-0.11.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
bfbbd38d0921435aa13518dab7940185438e6f5db66326550eeb4bbe46938ade
BLAKE2b-256 checksum
How to use checksums
6139da64834b75362a3257117d876ea6a9c89cf0d1527a919db7081702dc7ed6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Release files / fabisschomagut-0.11-py3-none-any.whl

Download URL fabisschomagut-0.11-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3b0bc479c6ef8d78bcfe9fd04aa1beb6c094bc9492c9968097c4a29df5feb633
BLAKE2b-256 checksum
How to use checksums
827757599a59a6649688ff88ec9f7bb19488f4a28a9cee647b581a51c1f6ce6f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Release history Release notifications | RSS feed

This release

0.11 This release

2 release files

0.10

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