I have groups of items, like:
<div data-group="1">Item</div>
<div data-group="1">Item</div>
<div data-group="1">Item</div>
<div data-group="2">Item</div>
<div data-group="2">Item</div>
I want to change the background color by group so I can tell them apart. But the background can't make the text unreadable.
I don't expect to have over 20 groups.
Is there a way to generate background colors that will always work with #000
text?
Or a way to know if it will work better with #000
or #fff
text so I can flip the text color if needed?
Or should I give up the idea to make it dynamic and just pre-allocate 20 colors (like Trello does for labels)?