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

Animated Circular Progress Bar - Tailwind colors #401

Open
JasonColeyNZ opened this issue Oct 31, 2024 · 6 comments
Open

Animated Circular Progress Bar - Tailwind colors #401

JasonColeyNZ opened this issue Oct 31, 2024 · 6 comments

Comments

@JasonColeyNZ
Copy link

Does it make sense that the Animated Circular Progress Bar allows the use of tailwind in the color selection?

Maybe allow className for both the gauge colors?

At present we need to access the tailwind config to get these colors, not that friendly?

@itsarghyadas
Copy link
Collaborator

  <AnimatedCircularProgressBar
      max={100}
      min={0}
      value={value}
      gaugePrimaryColor="rgb(79 70 229)"
      gaugeSecondaryColor="rgba(0, 0, 0, 0.1)"
 />

How are you thinking of using classnames here, as we need to pass two colors for the two gauges?

@JasonColeyNZ
Copy link
Author

JasonColeyNZ commented Dec 19, 2024

Could we not have a class sent to the class of the svg sections, like stroke-ring (ring being a color class in tailwind)

So gaugePrimaryColorClassName, gaugeSecondaryColorClassName?

@itsarghyadas
Copy link
Collaborator

@JasonColeyNZ So, you want to create a global variable using that name and then use it? Is that what you mean?

@JasonColeyNZ
Copy link
Author

If the AnimatedCircularProgressBar had two properties, like gaugePrimaryColorClassName and gaugeSecondaryColorClassName as well as the gaugePrimaryColor, then I could pass a standard tailwind classname, stroke-[whatever] and then i can easily use tailwind colors without having to resort to using tailwindConfig/resolveConfig to get the colors.

AnimatedCircularProgressBar
									className="h-6 w-6 text-[10px]"
									value={questionnaire.progress}
									max={100}
									min={0}
									gaugePrimaryColorClassName={"stroke-ring"}
									gaugeSecondaryColorClassName={"stroke-gray-200"}
								/>
<circle
						cx="50"
						cy="50"
						r="45"
						strokeWidth="10"
						strokeDashoffset="0"
						strokeLinecap="round"
						strokeLinejoin="round"
						className={cn("opacity-100", gaugeSecondaryColorClassName)}

Anyway, its easy enough for me to implement, just thought it could be an option in your version?

@itsarghyadas
Copy link
Collaborator

But since Tailwind’s default color palette can be restrictive, what if someone wants to use a specific hex color code? Will this change support hex codes as well? I believe you need to pass stroke-[#color]. Feel free to open a PR, and we’ll review it!

@JasonColeyNZ
Copy link
Author

tailwind allows arbitrary colors,
https://tailwindcss.com/docs/stroke#arbitrary-values
And normally I'd probably use a color used in my theming anyway?

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