import { fitGradient as fitGradientImplementation } from './fitGradient' ; import { getImageData } from './getImageData' ; import { hexColorString , linearGradient } from './format' ; import { getPalette as getPaletteImplemention } from './getPalette' ; export { getImageData } from './getImageData' ; remarks param image param numberOfColors param fast returns export function getPalette ( image , numberOfColors = 4 , fast = false ) { const imageData = getImageData ( image , fast ? 64 : 128 ) ; return getPaletteFromImageData ( imageData , numberOfColors ) ; } param imageData param numberOfColors returns export function getPaletteFromImageData ( imageData , numberOfColors = 4 ) { return getPaletteImplemention ( imageData , numberOfColors ) . map ( hexColorString ) ; } remarks param image returns export function fitGradient ( image ) { const imageData = getImageData ( image , 32 ) ; return fitGradientToImageData ( imageData ) ; } param imageData returns export function fitGradientToImageData ( imageData ) { const colors = fitGradientImplementation ( imageData ) . map ( hexColorString ) ; return linearGradient ( colors ) ; }