mirror of
https://github.com/metafy-social/python-scripts.git
synced 2025-01-18 07:17:03 +00:00
Merge pull request #69 from Farhan-2222/master
RGB to Hexadecimal converter
This commit is contained in:
commit
8493759dba
10
scripts/RGB_To_Hexa/README.md
Normal file
10
scripts/RGB_To_Hexa/README.md
Normal file
|
@ -0,0 +1,10 @@
|
|||
# About:
|
||||
|
||||
This is a readme file about rgb to hex converter. It is coded in python programming language.
|
||||
I have flake8 linting on this as well with no error/warning displayed.
|
||||
I am attaching a screenshot of input and output of the program.
|
||||
|
||||
|
||||
# Screenshot:
|
||||
|
||||
![Screenshot (132)](https://user-images.githubusercontent.com/87274221/193456660-c077c138-e8ed-4776-ac39-240735ee197d.png)
|
10
scripts/RGB_To_Hexa/rgb-to-hex.py
Normal file
10
scripts/RGB_To_Hexa/rgb-to-hex.py
Normal file
|
@ -0,0 +1,10 @@
|
|||
def rgb_to_hex(rgb):
|
||||
return '%02x%02x%02x' % rgb
|
||||
|
||||
|
||||
print("Enter the value of RGB color in (X,Y,Z) format:")
|
||||
X = int(input("Enter value of X: "))
|
||||
Y = int(input("Enter value of Y: "))
|
||||
Z = int(input("Enter value of Z: "))
|
||||
hex = rgb_to_hex((X, Y, Z))
|
||||
print("The hexadecimal value is: {}" .format(hex))
|
Loading…
Reference in New Issue
Block a user