mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-20 09:44:26 +08:00
migrate to typescript
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import type { ColorValue, ColorInfo } from '@/core/color.ts';
|
||||
|
||||
export function getColorsInRows(allColorValues: ColorValue[], itemPerRow: number): ColorInfo[][] {
|
||||
const ret: ColorInfo[][] = [];
|
||||
let rowCount = -1;
|
||||
|
||||
for (let i = 0; i < allColorValues.length; i++) {
|
||||
if (i % itemPerRow === 0) {
|
||||
ret[++rowCount] = [];
|
||||
}
|
||||
|
||||
ret[rowCount].push({
|
||||
color: allColorValues[i]
|
||||
});
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
Reference in New Issue
Block a user