The value shape.fill.fore_color.rgb
is an RGBColor
object.
RGBColor
is a subtype of tuple
and in particular a 3-tuple of int
. What you're getting with print()
is the str
representation which is a triple of two-hex-digit R, G, and B values, commonly used for specifying colors in for instance HTML/CSS.
You can extract the red value with:
rgb = shape.fill.fore_color.rgb
red_value = rgb[0]
Maybe easier is to unpack the tuple like this:
red, green, blue = shape.fill.fore_color.rgb
print("red == %d, green == %d, blue = %d" % (red, green, blue))
or more simply:
print("red == %d, green == %d, blue = %d" % shape.fill.fore_color.rgb)