A simple Python library for converting between Hexadecimal and RGB color formats
Project description
RGB2HEX
A simple Python library for converting between Hexadecimal and RGB color formats.
Features
- Convert Hex color codes to RGB format.
- Convert RGB format back to Hex color codes.
Installation
To install the library via pip:
pip install rgb2hex
Convert Hex to RGB
You can convert a hexadecimal color code to an RGB tuple like this:
from rgb2hex import hex2rgb
# Example usage
hex_code = "#ff5733"
rgb = hex2rgb(hex_code)
print(rgb) # Output: (255, 87, 51)
Convert RGB to Hex
You can convert an RGB list to a hexadecimal color code:
from rgb2hex import rgb2hex
# Example usage
rgb = [255, 87, 51]
hex_code = rgb2hex(rgb)
print(hex_code) # Output: #ff5733
Contributing
Feel free to open issues or submit pull requests if you'd like to contribute.
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
rgb2hex-0.1.0.tar.gz
(2.8 kB
view details)
Built Distribution
File details
Details for the file rgb2hex-0.1.0.tar.gz
.
File metadata
- Download URL: rgb2hex-0.1.0.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5d0ce6d4e0da663715f6172bda42dd7cb53835fedbb62091e1f6df372dbb7bf |
|
MD5 | 100ce200e73d8ad138997a98421f9603 |
|
BLAKE2b-256 | e4189ee9cca003cc7c64b5a015ed01ed6de3bc3f30a81812debcb96dc1f0b884 |
File details
Details for the file rgb2hex-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: rgb2hex-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1bd1253b53b45ccedaadb11ca735057ed38145c45545faa349418afa4f6c5bf3 |
|
MD5 | 0f1a55f664c4d7ceb2f3b57a5d2b7db2 |
|
BLAKE2b-256 | 565fcc987ea44edb7759b760f412ae004204fe329bb3113d991b9754c65690fc |