import { listOutputFiles, Template } from './index.js'; import { colorSetToVariants } from '../color-set/index.js'; const CELL_WIDTH = 676; const CELL_HEIGHT = 720; const PATTERN_WIDTH = CELL_WIDTH * 8; const PATTERN_HEIGHT = CELL_HEIGHT * 6; const template: Template = { name: 'Shirts wallpaper', render: async function* (colorSet, options) { const variants = colorSetToVariants(colorSet); for (const variant of variants) { for (const size of options.wallpaperSizes) { const { shade0, shade1, shade2, shade3, shade4, shade5, shade6, shade7, accent0, accent1, accent2, accent3, accent4, accent5, accent6, accent7, } = variant.colors; const scaleFactor = 3.25; const adjustedCellWidth = CELL_WIDTH / scaleFactor; const adjustedCellHeight = CELL_HEIGHT / scaleFactor; const cellCountX = size.w / adjustedCellWidth; const cellCountY = size.h / adjustedCellHeight; const surpriseX = Math.floor(cellCountX / 2) * adjustedCellWidth + (Math.floor(cellCountY / 2) % 2 === 0 ? 0 : adjustedCellWidth / 2); const surpriseY = Math.floor(cellCountY / 2) * adjustedCellHeight; const svg = ` `; yield { path: `${variant.title.kebab}-${size.w}x${size.h}.svg`, content: svg, }; } } }, renderInstructions: listOutputFiles, }; export default template;