# How to set colors fo Polydata for a custom reader?

**URL:** https://discourse.paraview.org/t/how-to-set-colors-fo-polydata-for-a-custom-reader/7584
**Category:** ParaView Support
**Created:** [July 10, 2021, 6:16am UTC](https://discourse.paraview.org/t/how-to-set-colors-fo-polydata-for-a-custom-reader/7584 "2021-07-10T06:16:05Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![lyz](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/l/e47774/32.png) [@lyz](https://discourse.paraview.org/u/lyz)
#### Post date: [July 10, 2021, 6:16am UTC](https://discourse.paraview.org/t/how-to-set-colors-fo-polydata-for-a-custom-reader/7584/1 "2021-07-10T06:16:05Z")

</div>

I am implementing a custom reader. The reader is derived from vtkAbstractPolyDataReader. When I implement the **RequestData** function, I specify the **points** and **polys** , and I can get the correct geometric. For now, I want set the colors for different part of polys, and I set scalars for different polydata. However, when I load the model, I can’t get the correct color. The problem I found is that, the model use the magnitude of the specific colors. And how to set colors for different polydata in a right way?

The code I used in the custom reader (derived from vtkAbstractPolyDataReader)

```auto
vtkPolyData *ply = vtkPolyData::New();
ply->SetPoints(DS->GetOutput()->GetPoints());//set the points
ply->SetPolys(DS->GetOutput()->GetPolys());//set the polys
ply->GetPointData()->SetScalars(colors);//set the scalar colors [r,g,b]

```

 ![render in pv](https://discourse.paraview.org/uploads/default/original/2X/9/9cc27c969eb4fca5bbbf8ba7eb576185d4c00ea1.png)

---

<div class="post-metadata">

### Author: ![nicolas.vuaille](https://discourse.paraview.org/user_avatar/discourse.paraview.org/nicolas.vuaille/32/5873_2.png) [@nicolas.vuaille](https://discourse.paraview.org/u/nicolas.vuaille)
#### Post date: [July 12, 2021, 10:06am UTC](https://discourse.paraview.org/t/how-to-set-colors-fo-polydata-for-a-custom-reader/7584/2 "2021-07-12T10:06:49Z")

</div>

You should uncheck the `Map Scalars` property in the `Display` section of the property panel.

---

<div class="post-metadata">

### Author: ![lyz](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/l/e47774/32.png) [@lyz](https://discourse.paraview.org/u/lyz)
#### Post date: [July 12, 2021, 12:38pm UTC](https://discourse.paraview.org/t/how-to-set-colors-fo-polydata-for-a-custom-reader/7584/3 "2021-07-12T12:38:46Z")

</div>

Thanks a lot! I can get the correct color now.
