I have this function:
getNewColor(): {} {
return colors.red;
}
And this object:
colors: any = {
red: {primary: '#ad2121',secondary: '#FAE3E3'},
blue: {primary: '#1e90ff',secondary: '#D1E8FF'},
yellow: {primary: '#e3bc08',secondary: '#FDF1BA'}
};
Every time getNewColor()
is being called, a new color from the object should be returned (doesn't matter what color as long it's hasn't been returned before).
If I call:
console.log(getNewColor());
console.log(getNewColor());
console.log(getNewColor());
The output should be:
{primary: '#ad2121',secondary: '#FAE3E3'}
{primary: '#e3bc08',secondary: '#FDF1BA'}
{primary: '#1e90ff',secondary: '#D1E8FF'}
What is the best way to implement getNewColor()
?