# Find text using text color (not background color)

**URL:** <https://forums.eggplantsoftware.com/t/find-text-using-text-color-not-background-color/8810>\
**Category:** Eggplant Functional\
**Tags:** script, sensetalk, eggplant-functional\
**Created:** [April 17, 2024, 9:17pm UTC](https://forums.eggplantsoftware.com/t/find-text-using-text-color-not-background-color/8810 "2024-04-17T21:17:31Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![shenpeng](https://forums.eggplantsoftware.com/letter_avatar_proxy/v4/letter/s/b77776/32.png) [@shenpeng](https://forums.eggplantsoftware.com/u/shenpeng)\
**Post date:** [April 19, 2024, 2:43am UTC](https://forums.eggplantsoftware.com/t/find-text-using-text-color-not-background-color/8810/5 "2024-04-19T02:43:29Z")

</div>

#getTextColor.script  
params searchArea  
set the searchRectangle to searchArea # for debug  
repeat with y = searchArea.Top to searchArea.Bottom  
repeat with x = searchArea.Left to searchArea.Right  
set dotColor to ColorAtLocation(x, y)  
#log “color at [”&x&“, “&y&”]=(”&dotColor&“)” # for debug  
set RGB to split(dotColor, “,”)  
set redPart to item 1 of RGB  
set greenPart to item 2 of RGB  
set bluePart to item 3 of RGB

```
	if (redPart<128 and greenPart>201 and bluePart<128) or \
			(greenPart>210 and redPart + bluePart<180) 
		return "green"
	else if redPart>201 and greenPart<128 and bluePart<128
		return "red"
	else if (redPart = 0) and \
			(greenPart between 113 and 126) and \
			(bluePart between 147 and 159)
		return "blue"
	else if (redPart between 125 and 130) and \
			(greenPart between 74 and 76) and \
			(bluePart between 46 and 50)
		return "yellow"
	end if
end repeat

```

end repeat  
set the searchRectangle to empty # for debug

---

_[View the full topic](https://forums.eggplantsoftware.com/t/find-text-using-text-color-not-background-color/8810)._
