Home/ Reference/ Color

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 at different brightnesses, loop on HSB; it's the least work.

Signature

color.HLSAssign(H, L, S) / color.HSBAssign(H, S, B) / color.GrayAssign(V)

Notes

In-place recolor via HLS, HSB or gray. To generate a scale of one hue at different brightnesses, loop on HSB; it's the least work.

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

for i in range(5):                                  # build a five-step blue ramp
    brightness = 80 + i * 40                        # lightness from 80 up to 240
    c.HSBAssign(210, 200, brightness)
    print("#", i + 1, "  lightness", brightness, " Hex:", c.HexValue)

About this section: Color

Color — RGB, CMYK and hex color values.

Other entries in this section