# How to change the color of markup node from python script?

**URL:** <https://discourse.slicer.org/t/how-to-change-the-color-of-markup-node-from-python-script/4762>\
**Category:** Development\
**Created:** [November 14, 2018, 4:55pm UTC](https://discourse.slicer.org/t/how-to-change-the-color-of-markup-node-from-python-script/4762 "2018-11-14T16:55:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![brhoom](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/brhoom/32/1228_2.png) [@brhoom](https://discourse.slicer.org/u/brhoom)\
**Post date:** [November 14, 2018, 4:55pm UTC](https://discourse.slicer.org/t/how-to-change-the-color-of-markup-node-from-python-script/4762/1 "2018-11-14T16:55:45Z")

</div>

Operating system: Ubuntu  
Slicer version: 4.10  
Expected behavior: Color changed  
Actual behavior: does not

Hi,

I am trying to change the color and the text scale of a markup node. the text scale works but the color does not. Here is the code:

```
     mNode = getNode('myMarkUpNode')
     mDisplayNode=slicer.vtkMRMLMarkupsDisplayNode()
     slicer.mrmlScene.AddNode(mDisplayNode)
     mNode.SetAndObserveDisplayNodeID(mDisplayNode.GetID())
     mDisplayNode.SetTextScale(1)
     mDisplayNode.SetColor(0,1,0)

```

How can I fix this?  
Thanks!

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [November 14, 2018, 5:29pm UTC](https://discourse.slicer.org/t/how-to-change-the-color-of-markup-node-from-python-script/4762/2 "2018-11-14T17:29:37Z")

</div>

No need to create a new display node, just use the current one. By default, markups are selected, so you may want to change color of the selected markups, too.

```auto
mDisplayNode = getNode('myMarkUpNode').GetDisplayNode()
mDisplayNode.SetTextScale(1)
mDisplayNode.SetColor(0,1,0)
mDisplayNode.SetSelectedColor(0,1,0)

```

---

<div class="post-metadata">

**Author:** ![brhoom](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/brhoom/32/1228_2.png) [@brhoom](https://discourse.slicer.org/u/brhoom)\
**Post date:** [November 14, 2018, 5:52pm UTC](https://discourse.slicer.org/t/how-to-change-the-color-of-markup-node-from-python-script/4762/3 "2018-11-14T17:52:35Z")

</div>

Thanks a lot for the quick reply and the valuable information. It seems SetColor does nothing. I only used SetSelectedColor and it works:

```
getNode('myMarkUpNode').GetDisplayNode()().SetSelectedColor(0,1,0)
```

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [November 14, 2018, 5:54pm UTC](https://discourse.slicer.org/t/how-to-change-the-color-of-markup-node-from-python-script/4762/4 "2018-11-14T17:54:02Z")

</div>

> [@brhoom](#):
>
> It seems SetColor does nothing

`SetColor` changes color of non-selected markups. Uncheck the checkbox next to the markup’s name in Markups module and you’ll then see how non-selected color is used.
