JSFiddle - React, Tailwind, and code Playground

by BrankoSabo

JavaScript

targetColorScheme = {
    shares: ['#FF5F00', '#FF9102', '#FFBF99'],
    creditors: ['#257886', '#31A3AE', '#A5E0E6'],
    interestRates: ['#FDC92A', '#FEDF7F', '#FEE9AA'],
}
const a = [
	{
		color: "red",
		value: "#f00"
	},
	{
		color: "green",
		value: "#0f0"
	},
	{
		color: "blue",
		value: "#00f"
	},
	{
		color: "cyan",
		value: "#0ff"
	},
	{
		color: "magenta",
		value: "#f0f"
	},
	{
		color: "yellow",
		value: "#ff0"
	},
	{
		color: "black",
		value: "#000"
	}
]

const b = a.map((m, index) => [{...m , c: targetColorScheme[0][index % 3]}])
console.log(b)