hexdropper.rgb_to_hex

Module Contents

Functions

rgb_to_hex(*args)

Convert RGB color to hexadecimal format.

hexdropper.rgb_to_hex.rgb_to_hex(*args)[source]

Convert RGB color to hexadecimal format.

Parameters:

*args – Variable length argument list. Can either be three integers (r, g, b) or a single tuple with three integers.

Returns:

The hexadecimal color code as a string. The format of the returned string is ‘#RRGGBB’.

Return type:

str

Examples

>>> rgb_to_hex(255, 0, 0)
'FF0000'  # Red color
>>> rgb_to_hex(0, 255, 0)
'00FF00'  # Green color
>>> rgb_to_hex(0, 0, 255)
'0000FF'  # Blue color