Dash Datatable styling


I was wondering if there is currently other ways to shade the color of a datatable’s rows other than the examples on the dash documentation page. What I would like to do is to shade every other group of three rows together, so every other triplet of rows is for example grey, and the other white. The only examples I see of coloring rows based on their row number is the ‘even’, ‘odd’ example on the site.


I figured it out, heres the hacky way of doing it.

def color_thirds(n):
    l = range(n)
    color = []
    t = True
    for i in l:
        if i % 3 == 0:
            t = not t
        if t:
    return color

and in table styling

                                'if': {'row_index': c},
                                'backgroundColor': 'rgb(248, 248, 248)'
                            } for c in color_thirds(len(grid))