Compare value in grid row to previous row

I have a grid field, where one column is {{ background_colour }}, where the editor can select a background colour for that row.

I need to be able to check if a row's background_colour is different to the previous row (if the colours are the same then the spacing between the rows needs to be different).

Is it possible to check if a value in a row is different to the previous?

>>>>>>> Unanswered <<<<<<<
2 Replies