How to use the themer/lib/prepare function in themer

To help you get started, we’ve selected a few themer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mjswensen / themer / web / src / generateZip.js View on Github external
export default async function generateZip(selections, colors, width, height, url, cliColors) {
  const zip = new JSZip();
  const preparedColors = prepareColors(colors, () => {});
  zip.file('Instructions.md', instructions(selections, url));
  zip.file('colors.js', colorsForCli(cliColors, url));
  for (const [key, selected] of Object.entries(selections)) {
    if (selected) {
      const files = await Promise.all(templates[key].render(
        preparedColors,
        key in resolutionOptions
          ? { [resolutionOptions[key]]: `${width}x${height}` }
          : {},
      ));
      files.forEach(file => {
        zip.folder(templates[key].folderName).file(file.name, file.contents);
      });
    }
  }
  return zip;

themer

Customizable theme generator for editors, terminals, wallpaper, and more.

MIT
Latest version published 2 days ago

Package Health Score

81 / 100
Full package analysis