Sometimes a random Color is needed to distinguish datasets, but without a meaning of the Color.
Support useing random Colors in Datadescription
Example Code:
// As per available Files found under the worldmap2d icons
const availableColors = [
'2A81CB',
'2AAD27',
'3D3D3D',
'7B7B7B',
'9C2B3C',
'CAC428',
'CB2B3E',
'CB8427',
'FFD326'
];
/**
- Returns a random color from the available color pool
- Ensures that each color is used only once until all available
- colors are exhausted, at which point the pool is reset
- @returns {string} Hex color string in the form "#RRGGBB"
*/
function randColor() {
if (currentColors.length === 0) {
currentColors = [...availableColors];
}
let index = Math.floor(Math.random() * currentColors.length);
let color = currentColors[index];
currentColors.splice(index, 1);
return "#" + color;
}
Sometimes a random Color is needed to distinguish datasets, but without a meaning of the Color.
Support useing random Colors in Datadescription
Example Code:
// As per available Files found under the worldmap2d icons
const availableColors = [
'2A81CB',
'2AAD27',
'3D3D3D',
'7B7B7B',
'9C2B3C',
'CAC428',
'CB2B3E',
'CB8427',
'FFD326'
];
/**
*/
function randColor() {
if (currentColors.length === 0) {
currentColors = [...availableColors];
}
let index = Math.floor(Math.random() * currentColors.length);
let color = currentColors[index];
currentColors.splice(index, 1);
return "#" + color;
}