# vtkLineWidget Modify Line Color ?

**URL:** https://discourse.vtk.org/t/vtklinewidget-modify-line-color/12754
**Category:** vtk.js
**Created:** [November 20, 2023, 5:34am UTC](https://discourse.vtk.org/t/vtklinewidget-modify-line-color/12754 "2023-11-20T05:34:04Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![sheonny](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sheonny/32/8482_2.png) [@sheonny](https://discourse.vtk.org/u/sheonny)
#### Post date: [November 20, 2023, 5:34am UTC](https://discourse.vtk.org/t/vtklinewidget-modify-line-color/12754/1 "2023-11-20T05:34:04Z")

</div>

May I ask how to modify the line color for vtkLineWidget

---

<div class="post-metadata">

### Author: ![Thibault\_Bruyere](https://discourse.vtk.org/user_avatar/discourse.vtk.org/thibault_bruyere/32/6585_2.png) [@Thibault\_Bruyere](https://discourse.vtk.org/u/Thibault_Bruyere)
#### Post date: [November 20, 2023, 12:06pm UTC](https://discourse.vtk.org/t/vtklinewidget-modify-line-color/12754/2 "2023-11-20T12:06:59Z")

</div>

Hello,

You can change the color of the actor directly:

```js
const widget = widgetManager.getWidgets()[0];
const actor = widget.getRepresentations()[3].getActors()[0];
actor.getProperty().setColor(color);

```

I find it hacky and it would be better if it was set in the state of the widget as for line thickness:

```js
widget.getWidgetState().setLineThickness(10); // works fine
widget.getWidgetState().setLineColor(color); // setColor is undefined

```

Maybe @finetjul knows a better way to do it?

---

<div class="post-metadata">

### Author: ![Thibault\_Bruyere](https://discourse.vtk.org/user_avatar/discourse.vtk.org/thibault_bruyere/32/6585_2.png) [@Thibault\_Bruyere](https://discourse.vtk.org/u/Thibault_Bruyere)
#### Post date: [November 20, 2023, 12:10pm UTC](https://discourse.vtk.org/t/vtklinewidget-modify-line-color/12754/3 "2023-11-20T12:10:17Z")

</div>

Oh I see that you already replied in [this other thread](https://discourse.vtk.org/t/move-in-3d-linewidget-on-reslicecursorwidget/12253/7) @finetjul  
Sorry for the ping
