Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to add your own colors? #4

Open
Codemaine opened this issue Aug 21, 2023 · 2 comments
Open

Ability to add your own colors? #4

Codemaine opened this issue Aug 21, 2023 · 2 comments

Comments

@Codemaine
Copy link

No description provided.

@cristicretu
Copy link
Owner

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);

@Codemaine
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants