Learn how to Convert RGB to HEX in Python
Created
May 14, 2025 05:29
-
-
Save aspose-com-gists/ba00dab4ec539b3829c9bdc4f21f14ae to your computer and use it in GitHub Desktop.
Convert RGB to HEX in Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import aspose.svg as svg | |
# Create a Color instance | |
color = svg.drawing.Color.from_rgb(255, 0, 0) # RGB for Red | |
# Convert to HEX | |
hex_value = color.to_rgb_hex_string() | |
print(hex_value) # Output: #FF0000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import aspose.svg as svg | |
# Create a Color instance | |
color = svg.drawing.Color.from_rgba(222, 180, 135, 1) | |
# Convert to HEX | |
hex_value = color.to_rgb_hex_string() | |
print(hex_value) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment