UNPKG

@harryho/swatch-color

Version:

The customized package for the color of swatches.

34 lines (28 loc) 736 B
import type { SwatchColor } from './types' export function genSwatchColor(colorData: SwatchColor): SwatchColor | null { let swatchColor: any; if (isValidColorData(colorData)) { return swatchColor = { ...colorData } } else return null } // The validation here is just dummy one function isValidColorData(colorData: SwatchColor): boolean { let isValid = true; switch (colorData.type) { case "rgb": // TODO -- Add your validation here break; case "hsl": // TODO -- Add your validation here break; case "brgb": // TODO -- Add your validation here break; } return isValid; }