# vtkCaptionActor2D cannot change the background color

**URL:** https://discourse.vtk.org/t/vtkcaptionactor2d-cannot-change-the-background-color/8247
**Category:** Support
**Created:** [April 10, 2022, 8:23am UTC](https://discourse.vtk.org/t/vtkcaptionactor2d-cannot-change-the-background-color/8247 "2022-04-10T08:23:58Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![zhang-qiang-github](https://discourse.vtk.org/user_avatar/discourse.vtk.org/zhang-qiang-github/32/2519_2.png) [@zhang-qiang-github](https://discourse.vtk.org/u/zhang-qiang-github)
#### Post date: [April 10, 2022, 8:23am UTC](https://discourse.vtk.org/t/vtkcaptionactor2d-cannot-change-the-background-color/8247/1 "2022-04-10T08:23:58Z")

</div>

I am using `vtkCaptionActor2D` in my project, and I can not specify its’ background color.

The minimal code to reproduce my question is:

```auto
import vtkmodules.all as vtk

line = vtk.vtkLineSource()
line.SetPoint1(0, 0, 0)
line.SetPoint2(1, 1, 1)
line.Update()

mapper = vtk.vtkPolyDataMapper()
mapper.SetInputData(line.GetOutput())
actor = vtk.vtkActor()
actor.SetMapper(mapper)

render = vtk.vtkRenderer()
render.AddActor(actor)
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(render)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
iren.SetInteractorStyle(vtk.vtkInteractorStyleTrackballCamera())

captionActor = vtk.vtkCaptionActor2D()
captionActor.SetCaption('caption')
captionActor.SetAttachmentPoint(1, 1, 1)
property = captionActor.GetCaptionTextProperty()
property.SetBackgroundColor(1, 0, 0)

render.AddActor(captionActor)

iren.Initialize()
iren.Start()

```

But the background color do not change:

![image](https://discourse.vtk.org/uploads/default/original/2X/c/c8ea58a0648aeb68d48db29af2f592cfe02da139.png)

I also tried `captionActor.GetTextActor().GetTextProperty().SetBackgroundColor(1, 0, 0)`, but it still do not work.

Any suggestion is appreciated~~~

---

<div class="post-metadata">

### Author: ![zhang-qiang-github](https://discourse.vtk.org/user_avatar/discourse.vtk.org/zhang-qiang-github/32/2519_2.png) [@zhang-qiang-github](https://discourse.vtk.org/u/zhang-qiang-github)
#### Post date: [April 12, 2022, 1:55pm UTC](https://discourse.vtk.org/t/vtkcaptionactor2d-cannot-change-the-background-color/8247/2 "2022-04-12T13:55:11Z")

</div>

I find that the reason why background color do not change is: the background opacity is 0.0.

If I set the background opacity to 1.0, the `SetBackgroundColor` will work.
