/** * Generate Avatar components for all icon directories * * This script creates avatar.tsx for each icon that has a color.tsx, * then updates the per-icon index.ts to include the Avatar export. * * Smart background detection: * - SVGs with a detected background shape → full-bleed Color icon (100% fill) * - SVGs without background → padded Color icon (75%) on neutral bg-background * * Usage: * pnpm tsx scripts/generate-avatars.ts --type=providers * pnpm tsx scripts/generate-avatars.ts --type=models */ import * as fs from 'fs' import * as path from 'path' import { type Config, optimize } from 'svgo' import { generateAvatar as codegenAvatar, generateBarrelIndex as codegenBarrelIndex, generateCatalog as codegenCatalog, generateIconIndex as codegenIconIndex } from './codegen' import { buildSvgMap, collectIconDirs, ensureViewBox, getComponentName, isImageBased, isWhiteFill, OUTPUT_DIR_MAP, parseLogoTypeArg, parseSvgPathBounds, readColorPrimary } from './svg-utils' import { createRemoveBackgroundPlugin } from './svgo-remove-background' /** * Extract CSS fill values from