# Find and Replace: Vision Component Colors

**URL:** <https://forum.inductiveautomation.com/t/find-and-replace-vision-component-colors/70481>\
**Category:** Ignition\
**Tags:** ignition81, vision\
**Created:** [March 1, 2023, 3:34pm UTC](https://forum.inductiveautomation.com/t/find-and-replace-vision-component-colors/70481 "2023-03-01T15:34:25Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [March 2, 2023, 5:00pm UTC](https://forum.inductiveautomation.com/t/find-and-replace-vision-component-colors/70481/7 "2023-03-02T17:00:28Z")

</div>

I rewrote @justinedwards.jle's example with an eye for performance; basically avoiding a lot of unnecessary allocations of new Color objects:

```python
findColor = system.gui.color(0, 0, 0)
replaceColor = system.gui.color(255, 255, 255)

def colorFinder(component):
	for component in component.getComponents():
		if component.background.rgb == findColor.rgb
			component.background = replaceColor
		if component.foreground.rgb == findColor.rgb
			component.foreground = replaceColor
		colorFinder(component)

parentWindow = system.gui.getParentWindow(event)
colorFinder(parentWindow)

```

---

_[View the full topic](https://forum.inductiveautomation.com/t/find-and-replace-vision-component-colors/70481)._
