meshgrad icon indicating copy to clipboard operation
meshgrad copied to clipboard

Ability to add your own colors?

Open Codemaine opened this issue 1 year ago • 2 comments

Codemaine avatar Aug 21 '23 12:08 Codemaine

hey, you can provide your own initial color, the rest of them will be generated automatically (analogous and complementary):

const generateMeshGradient = (
  length: number,
  baseColor?: string,
  hash?: number
) => {
  const [bgColor, bgImage] = genStops(
    length,
    hexToHSL(baseColor) ? hexToHSL(baseColor) : undefined,
    hash ? hash : undefined
  );
  return `background-color: ${bgColor}; background-image:${bgImage}`;
};

usage:

generateMeshGradient(6, #088F8F);

cristicretu avatar Aug 21 '23 17:08 cristicretu

What if you want to provide all the colors it should use?

Codemaine avatar Aug 22 '23 18:08 Codemaine