UNPKG

@bubblewrap/core

Version:

Core Library to generate, build and sign TWA projects

38 lines (37 loc) 1.27 kB
import * as Jimp from 'jimp'; import Color = require('color'); export interface IconDefinition { dest: string; size: number; } interface Icon { url: string; data: Jimp; } export declare class ImageHelper { private saveIcon; /** * Generate a file for the given icon inside targetDir. * * @param {Object} icon Object containing the original URL and the icon image data. * @param {string} targetDir Path to the directory the image will be saved in. * @param {Object} iconDef Icon definitions specifying the size the icon should be exported as. */ generateIcon(icon: Icon, targetDir: string, iconDef: IconDefinition, backgroundColor?: Color): Promise<void>; /** * Set the color of a monochrome icon to be the theme color. * * @param {Object} icon Original monochrome icon to use. * @param {Color} themeColor Color to use for the icon. * @returns New image data. */ monochromeFilter(icon: Icon, themeColor: Color): Promise<Icon>; /** * Fetches an Icon. * * @param {string} iconUrl the URL to fetch the icon from. * @returns an Object containing the original URL and the icon image data. */ fetchIcon(iconUrl: string): Promise<Icon>; } export {};