# Change color box within 3D view

**URL:** <https://discourse.slicer.org/t/change-color-box-within-3d-view/24350>\
**Category:** Development\
**Created:** [July 17, 2022, 8:05pm UTC](https://discourse.slicer.org/t/change-color-box-within-3d-view/24350 "2022-07-17T20:05:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![keri](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/keri/32/11618_2.png) [@keri](https://discourse.slicer.org/u/keri)\
**Post date:** [July 17, 2022, 8:05pm UTC](https://discourse.slicer.org/t/change-color-box-within-3d-view/24350/1 "2022-07-17T20:05:49Z")

</div>

Hi,

[The issue already been asked](https://discourse.slicer.org/t/how-to-change-color-of-3d-cube-inside-3d-view/769/10) but still I’m trying to struggle with this.

The idea is to modify the color of the cube from 3D view when the view is created within SlicerCAT.  
To solve this I need to understand how to get this cube as VTK or MRML object. Who is responsible for creating it?

For example I can see that [vtkMRMLViewNode](https://github.com/Slicer/Slicer/blob/115e32bdf8e478208fc2c75179cf2ecdb555d984/Libs/MRML/Core/vtkMRMLViewNode.h#L318) has `BoxVisible` attribute. To modify visibility one simply triggers this attribute:

```python
viewNode = slicer.app.layoutManager().threeDWidget(0).mrmlViewNode()
viewNode.SetBoxVisible(1)

```

Can’t understand how it works… Who is observer or who manages it from VTK side?

---

<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:** [July 18, 2022, 7:58am UTC](https://discourse.slicer.org/t/change-color-box-within-3d-view/24350/2 "2022-07-18T07:58:29Z")

</div>

All view content is displayed using [displayable managers](https://slicer.readthedocs.io/en/latest/developer_guide/mrml_overview.html?highlight=displayable%20manager#the-displayable-manager).

The purple box is displayed by vtkMRMLViewDisplayableManager. The color is hardcoded, so you need to add an API to change it. Probably the cleanest solution would be to add a `BoxColor` property to `vtkMRMLViewNode`.

---

<div class="post-metadata">

**Author:** ![keri](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/keri/32/11618_2.png) [@keri](https://discourse.slicer.org/u/keri)\
**Post date:** [July 18, 2022, 12:54pm UTC](https://discourse.slicer.org/t/change-color-box-within-3d-view/24350/3 "2022-07-18T12:54:07Z")

</div>

Thank you,

Completely forgot that such things are controlled by displayable managers.

[The PR is ready](https://github.com/Slicer/Slicer/pull/6467)
