Skip to main content

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


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.dev1022.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

rgb2hex-0.1.0.dev1022-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file rgb2hex-0.1.0.dev1022.tar.gz.

File metadata

  • Download URL: rgb2hex-0.1.0.dev1022.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

Hashes for rgb2hex-0.1.0.dev1022.tar.gz
Algorithm Hash digest
SHA256 849720776ab910b9253f04bae2de3b190a855aebd084e26c4ebaf087b921688d
MD5 fbf2c23e41dc5bfda1af079acf7f2d98
BLAKE2b-256 f07fca6a44c8fe6147401690c288882466ca44c181f12dddf3fd8ad629517769

See more details on using hashes here.

File details

Details for the file rgb2hex-0.1.0.dev1022-py3-none-any.whl.

File metadata

File hashes

Hashes for rgb2hex-0.1.0.dev1022-py3-none-any.whl
Algorithm Hash digest
SHA256 d71605613d333d951e3a0dceaf05003b9965f1382923f17cef18cc22580029ed
MD5 42a7063cce570b933bc168e489357c4c
BLAKE2b-256 26885c14b970f5899885129461c92f7073f784b8ea888c7de8c7bca7dc3cb021

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