Home/ Reference/ Color

color.StringAssign("#0085CD") / color.ToString()

Sets a color straight from a hex string. The one that suits designers — paste the client's color code in and skip the RGB arithmetic.

Signature

color.StringAssign("#0085CD") / color.ToString()

Notes

Sets a color straight from a hex string. The one that suits designers — paste the client's color code in and skip the RGB arithmetic.

Python example (runnable)

Requires pywin32. The example assumes app / doc / page / layer are already connected. See Connection & Init
Python
shape = app.ActiveSelectionRange(1)
c = shape.Fill.UniformColor

c.StringAssign("#0085CD")                           # assign the hex directly
print("Read back after setting: ", c.HexValue)
print("As string: ", c.ToString())

About this section: Color

Color — RGB, CMYK and hex color values.

Other entries in this section