def rgb_to_hex(rgb: tuple = None): if rgb: return ''.join([str(hex(num)).replace('0x', '').zfill(2) for num in rgb]) if __name__ == '__main__': print(rgb_to_hex(rgb=(0, 255, 0)))
C:\python310\python.exe C:\PycharmProject\test1.py
00ff00
Process finished with exit code 0