davidhu2000 / react-spinners

A collection of loading spinner components for react
https://www.davidhu.io/react-spinners
MIT License
3k stars 260 forks source link

feat: color prop can accept rgb colors #586

Closed Roman178 closed 1 week ago

Roman178 commented 2 months ago

What changes are introduced?

HashLoader didn't accept rgb or rgba color (issue https://github.com/davidhu2000/react-spinners/issues/582). I have added a new function that handles rgb color strings.

According to the docs in the mozilla (https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/rgb), I tried to take into account all the cases, namely: rgb(255 255 255 / 80%) rgb(255 255 255) rgb(255, 255, 255, 0.8) rgb(255, 255, 255)

and their aliases rgba(...

I gave more priority to the opacity value contained in the rgb string. If the string does not contain this value, the opacity value is taken from the argument. I can change it if necessary.

Also I added new test cases for the function calculateRgba

I kindly ask you to review my PR. @davidhu2000

davidhu2000 commented 2 months ago

@Roman178 thanks for this update, i'll take a look in the next week or two. Crazy busy these days. Appreciate the patience

Roman178 commented 2 months ago

@davidhu2000 Thanks for the heads-up. No rush at all. I appreciate your time.

Roman178 commented 1 week ago

Hi @davidhu2000, I hope you're doing well! I just wanted to follow up on my pull request. I understand you're very busy, but if you could find a moment to review it, I would greatly appreciate it.

Thank you for your time and consideration!

davidhu2000 commented 1 week ago

hey @Roman178 the code looks good. I'll get this published as a new version soon

Roman178 commented 1 week ago

@davidhu2000 thanks for approving my PR.