folderkit
Version:
Pixel-perfect macOS folder icons generator for developers.
56 lines (55 loc) • 2.06 kB
TypeScript
import type { IconSetOptions, Options } from './types';
import type { SharpInput } from 'sharp';
/**
* Generates a folder icon in native macOS style from the specified input image.
*
* @param input - Input image (Buffer, Uint8Array, or file path) to be used as the folder icon
* @param options - Generation options including theme and resolution
* @returns Promise that resolves to the generated icon as a PNG Buffer
*
* @example
* // Basic usage with default options (BigSurLight theme, 256x256 non-retina)
* const icon = await generate(inputBuffer);
*
* @example
* // Custom theme and resolution
* const icon = await generate(inputBuffer, {
* theme: FolderTheme.BigSurDark,
* resolution: Resolution.Retina512,
* trim: false
* });
*
* @example
* // Using with file system
* import { promises as fs } from 'fs';
*
* async function createIcon() {
* const input = await fs.readFile('input.png');
* const icon = await generate(input, {
* theme: FolderTheme.Tahoe,
* resolution: Resolution.NonRetina128
* });
* await fs.writeFile('folder-icon.png', icon);
* }
*/
export declare const generate: (input: SharpInput, options?: Options) => Promise<Buffer>;
/**
* Generates a complete icon set (.iconset folder) for macOS from the specified input image.
*
* @param input - Input image (Buffer, Uint8Array, or file path) to be used as the folder icon
* @param output - Output directory path for the generated .iconset (will be created if it does not exist)
* @param options - Optional icon set generation options including theme and trim
* @returns Promise that resolves when the icon set has been generated
*
* @example
* // Basic usage with default options
* await generateIconSet(inputBuffer, 'MyFolder.iconset');
*
* @example
* // Custom theme and options
* await generateIconSet(inputBuffer, 'Custom.iconset', {
* theme: FolderTheme.BigSurDark,
* trim: false
* });
*/
export declare const generateIconSet: (input: SharpInput, output: string, options?: IconSetOptions) => Promise<void>;