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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hexToRGB function could be utility function and can be used by several components #159

Open
alamenai opened this issue Jun 15, 2024 · 2 comments

Comments

@alamenai
Copy link
Contributor

Hi @dillionverma ,

While I was reading the code of Particles component, I found this function :

function hexToRgb(hex: string): number[] {
  hex = hex.replace("#", "");
  const hexInt = parseInt(hex, 16);
  const red = (hexInt >> 16) & 255;
  const green = (hexInt >> 8) & 255;
  const blue = hexInt & 255;
  return [red, green, blue];
}

I guess it could a utility function that can be used by several components.

@dillionverma
Copy link
Collaborator

appreciate it! where else would you use this?

@alamenai
Copy link
Contributor Author

alamenai commented Jul 9, 2024

Hi @dillionverma , it's already found on Particles but we can extract it for potential usage in other components as utility function.

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