react-vis
react-vis copied to clipboard
How to use the same color for title and stroke using props or inline style
Hello, please help me to use the same color for the titles and for the strokes. I have a method where i generate colors. After that i want to use that colors for strokes and for titles. Thank you.
const colorGenerator = colorsNumber => { if (colorsNumber) { let randomColors = [] for (let i = 0; i < colorsNumber; i++) { let color = Math.floor(Math.random() * 16777215).toString(16) if (color.length === 5) { color = color + '0' } randomColors.push('#' + color) } return randomColors } }
const handleLegend = () => { let items = [] measurements.forEach((m, i) => items.push({ title: m.substanceName, color: measurementColors[i] }) ) return items }
<DiscreteColorLegend items={handleLegend()} />