I am creating a checklist in my Dash application and I would like to color each item differently. I have a list of objects where each object has a .name and .color value. I am currently able to create each item with i.name and apply the same color (e.g. red) to all items
for i in STRUCTURES:
checklist_options.append({'label':i.name, 'value':i.number})
checklist = dcc.Checklist(
options=checklist_options,
value=[],
style={'color': 'white',
'font-size': '25px'
},
labelStyle={'color':'red'}
)
return checklist
When I 'inspect the element' of the resulting checklist - I can manually change the color of each element through element.style on the 'inspect element' side panel of my browser. Is there a way to apply colors individually to each element when I am generating them? Maybe something like:
checklist_options.append({'label':i.name, 'value':i.number, 'color':i.color})
which obviously doesn't work.
Aucun commentaire:
Enregistrer un commentaire