react-native-fiesta
Version:
A set of celebration animations powered by Skia. Engage more with your users by celebrating in your React Native application.
16 lines • 494 B
JavaScript
import { shuffleArray } from './array';
export function colorsFromTheme(theme, itemsToRender) {
const newColors = [];
let colorToPushIndex = 0;
const randomisedColors = shuffleArray(theme);
new Array(itemsToRender).fill(0).map(() => {
if (colorToPushIndex === randomisedColors.length - 1) {
colorToPushIndex = 0;
} else {
colorToPushIndex++;
}
newColors.push(randomisedColors[colorToPushIndex]);
});
return newColors;
}
//# sourceMappingURL=colors.js.map