color.HexValue / color.RGBValue
HexValue is a #RRGGBB string you can match against the swatch in the design file; RGBValue is RGB packed into a single integer.
Signature
color.HexValue / color.RGBValue
Notes
HexValue is a #RRGGBB string you can match against the swatch in the design file; RGBValue is RGB packed into a single integer.Python example (runnable)
Requires
pywin32. The example assumes app / doc / page / layer are already connected.
See Connection & InitPython
shape = app.ActiveSelectionRange(1)
c = shape.Fill.UniformColor
print("Hex: ", c.HexValue) # for example #0085CD
print("RGB integers: ", c.RGBValue)
# decide from the hex value: is it pure black
if c.HexValue.upper() == "#000000":
print("This is pure black")
About this section: Color
Color — RGB, CMYK and hex color values.
- This section has 10 entries; this is one of them.
- See the full section index: Color
Other entries in this section
- app.CreateRGBColor(Red, Green, Blue)Builds an RGB color, each component 0-255. Screen work, web images, so
- app.CreateCMYKColor(Cyan, Magenta, Yellow, Black)Builds a CMYK color, each component 0-100. If the job ends up on press
- app.CreateGrayColor(Value) / CreateHLSColor(H, L, S) / CreateHSBColor(H, S, B)Three more ways to build a color: gray (0-255), HLS, HSB. For lighter
- color.RGBAssign(R, G, B) / color.CMYKAssign(C, M, Y, K)Changes the components of an existing color in place. No new object —
- color.HLSAssign(H, L, S) / color.HSBAssign(H, S, B) / color.GrayAssign(V)In-place recolor via HLS, HSB or gray. To generate a scale of one hue
- color.ConvertToCMYK() / ConvertToRGB() / ConvertToGray() / ConvertToHLS()Explicit color model conversion. It mutates the object rather than ret
- color.BlendWith(OtherColor, Weight)Mixes two colors into an in-between shade. Automatic palettes and tona
- color.CopyAssign(SourceColor) / color.IsSame(OtherColor)Copies one color's values onto another (without changing object refere