Color for items according to the order (React Native)

Screenshot 2024-01-15 165234

hello can you guys help me.
I want to make a color in the flatlist, so on row 1 (0001) it is blue, then on row 2 check “is the item in row one the same as row 2?”, if it is the same then the color is also the same…

  • then when you go to row 3, you have an item that is different from item 2, so the color is also different.
  • then when you go to row 4, you have an item that is different from item 3, so the color is also different.
    -etc.
    thanks-