Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save aspose-com-gists/ba00dab4ec539b3829c9bdc4f21f14ae to your computer and use it in GitHub Desktop.
Save aspose-com-gists/ba00dab4ec539b3829c9bdc4f21f14ae to your computer and use it in GitHub Desktop.
Convert RGB to HEX in Python
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
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