# How to modify the line color of LineWidget？

**URL:** https://discourse.vtk.org/t/how-to-modify-the-line-color-of-linewidget/15042
**Category:** vtk.js
**Created:** [December 18, 2024, 3:02am UTC](https://discourse.vtk.org/t/how-to-modify-the-line-color-of-linewidget/15042 "2024-12-18T03:02:56Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Anultra](https://discourse.vtk.org/user_avatar/discourse.vtk.org/anultra/32/9428_2.png) [@Anultra](https://discourse.vtk.org/u/Anultra)
#### Post date: [December 18, 2024, 3:02am UTC](https://discourse.vtk.org/t/how-to-modify-the-line-color-of-linewidget/15042/1 "2024-12-18T03:02:56Z")

</div>

When using LineWidget for line measurement, there is no way to modify the color of the lines, and the colors of rectangles and circles are different from it.  
How should I handle this issue?

---

<div class="post-metadata">

### Author: ![sankhesh](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sankhesh/32/73_2.png) [@sankhesh](https://discourse.vtk.org/u/sankhesh)
#### Post date: [December 18, 2024, 2:36pm UTC](https://discourse.vtk.org/t/how-to-modify-the-line-color-of-linewidget/15042/2 "2024-12-18T14:36:26Z")

</div>

First, prefer `vtkLineWidget2` over `vtkLineWidget. Then use [vtkLineRepresentation::GetLineProperty](https://vtk.org/doc/nightly/html/classvtkLineRepresentation.html#a61b009b9abad159288b37a6a4cd81a01) to access and change properties like color, line width, etc. for the line.
