Checking to see if pixel index is in array

For one of my patterns I’m trying to colour items based on arrays of pixels within the project.
I’ve used array literals to identify the grouping of pixels, but I need to use those groupings to ensure that each array each has the same colour at a given time.
As pixel blaze doesn’t have the array.includes() function, what is the best method to check to see if the pixel is in a given array when I pick the render colour?

Example of arrays

F_T_R = [0,1,2,9,10,11,18,19,20]
F_T_M = [9,10,11,12,13,14,15,16,17]
F_T_L = [18,19,20,21,22,23,24,25,26]

The fastest would be to have an array with group ids as the values. This way you can get the group with a single lookup based on the pixel. Eg

group = pixelGroups[index]

Then set color based on the group.

2 Likes