# How to populate vtkColorSeries with specific RGB values?

**URL:** https://discourse.vtk.org/t/how-to-populate-vtkcolorseries-with-specific-rgb-values/6966
**Category:** Support
**Created:** [October 25, 2021, 9:18pm UTC](https://discourse.vtk.org/t/how-to-populate-vtkcolorseries-with-specific-rgb-values/6966 "2021-10-25T21:18:38Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Tomasso](https://discourse.vtk.org/user_avatar/discourse.vtk.org/tomasso/32/5786_2.png) [@Tomasso](https://discourse.vtk.org/u/Tomasso)
#### Post date: [October 25, 2021, 9:18pm UTC](https://discourse.vtk.org/t/how-to-populate-vtkcolorseries-with-specific-rgb-values/6966/1 "2021-10-25T21:18:38Z")

</div>

How to populate a vtkColorSeries with specific RGB values? I see method vtkColorSeries::SetColor(index, vtkColor3ub &) and examples that populate the series with vtkNamedColors, e.g. to set the 0th color in the series:

`colorSeries->SetColor(0, colors->GetColor3ub("turquoise_blue"))`

But how would I set the 0th color to R=0.00, G=1.00, B=0.94? How can I create a vtkColor3ub from just RGB values rather than named colors? Google search of “vtkColor3ub rgb” yields mostly references to vtkNamedColors…

Thanks  
Tom

---

<div class="post-metadata">

### Author: ![apteroti](https://discourse.vtk.org/user_avatar/discourse.vtk.org/apteroti/32/4846_2.png) [@apteroti](https://discourse.vtk.org/u/apteroti)
#### Post date: [May 16, 2023, 10:34pm UTC](https://discourse.vtk.org/t/how-to-populate-vtkcolorseries-with-specific-rgb-values/6966/2 "2023-05-16T22:34:30Z")

</div>

Hi,

This is an old topic, and I’m pretty sure you have already found the answer. But for other people with the same question, here is the solution:

```auto
vtkNew<vtkNamedColors> nc;
nc->SetColor("customColor", 1, 0.992, 0.815); // Just a random RGB color, I named it customColor

vtkNew<vtkColorSeries> colorsSeries;
colorsSeries->AddColor(nc->GetColor3ub("customColor"));
colorsSeries->AddColor(nc->GetColor3ub("turquoise_blue"));

```

Best,

Kaveh
