Author Topic: How to set layer color in Python  (Read 2749 times)

Offline Dragonfly

  • CNC Jedi
  • *****
  • Posts: 2652
    • View Profile
How to set layer color in Python
« on: April 05, 2024, 12:35:10 pm »
I can read and print the color of a given layer (Layer.Color) but couldn't hit the right syntax to pass color value (System.Drawing.Color) to change it.
Someone with a clue?

Offline Dragonfly

  • CNC Jedi
  • *****
  • Posts: 2652
    • View Profile
Re: How to set layer color in Python
« Reply #1 on: April 05, 2024, 15:46:27 pm »
OK, I think I got it.
Using Color property: Layer.Color = Color.Red
Using XmlColor property: Layer.XmlColor = "255,0,0,"

Code: [Select]
        nlayer = Layer()
        nlayer.Name = "Circles"
#        nlayer.XmlColor = "255,0,0"
        nlayer.Color = Color.Red
        doc.Layers.Add(nlayer)
« Last Edit: April 05, 2024, 15:50:17 pm by Dragonfly »