I want to assign a different color depending on the elements of a list that displays the days of the week (from DB Supabase).
I tested the random, it’s good but I would like to assign a specific color for each day of the week.
A track ?
To assign a specific color to each day of the week in a list, you can create a map of colors where the keys are the days of the week and the values are the corresponding colors. Then, when building the list, you can use the day of the week as the key to retrieve the color from the map.
2
Answers
To assign a specific color to each day of the week in a list, you can create a map of colors where the keys are the days of the week and the values are the corresponding colors. Then, when building the list, you can use the day of the week as the key to retrieve the color from the map.
Try with this one
Output: