Files
ezbookkeeping/src/lib/color.js
T
2023-08-13 15:03:31 +08:00

17 lines
341 B
JavaScript

export function getColorsInRows(allColorInfos, itemPerRow) {
const ret = [];
let rowCount = -1;
for (let i = 0; i < allColorInfos.length; i++) {
if (i % itemPerRow === 0) {
ret[++rowCount] = [];
}
ret[rowCount].push({
color: allColorInfos[i]
});
}
return ret;
}