https://github.com/webtechmoz/rgb2hex
Biblioteca para conversão de cores entre rgb e hexadecimal
https://github.com/webtechmoz/rgb2hex
Last synced: 4 months ago
JSON representation
Biblioteca para conversão de cores entre rgb e hexadecimal
- Host: GitHub
- URL: https://github.com/webtechmoz/rgb2hex
- Owner: webtechmoz
- License: mit
- Created: 2024-10-22T12:52:30.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-10-22T12:54:38.000Z (over 1 year ago)
- Last Synced: 2025-12-02T16:46:37.748Z (6 months ago)
- Language: Python
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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:
```bash
pip install rgb2hex
```
## Convert Hex to RGB
You can convert a hexadecimal color code to an RGB tuple like this:
```python
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:
```python
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.