feat: Add gradient style option - #72
Conversation
|
@TheGameProfi is attempting to deploy a commit to the Conrad's projects Team on Vercel. A member of the Team first needs to authorize it. |
d52a511 to
89010d5
Compare
|
Hey, |
There was a problem hiding this comment.
Sorry for the delay - here's what I think would work best, and it's a little tricky since we need to avoid using hashes:
Let's keep the background parameter and not worry about adding another parameter for gradient - rather, it can use the background value as given. That is, you could have ?background=2500dc or ?background=linear-gradient(45deg,f00,0f0) and it will work both ways. If the length of the background parameter is 3 or 6 (for pure hex codes), append a # to the beginning if it is. If not, split by comma and then run the same check (length is 3 or 6) and append the # if necessary. With this method, they should be able to use rgb or rgba as well, just without the commas.
After all that, if you don't mind updating the readme to be in line with this too, that'd be great. Make sure to specify that hex codes should be used without the #
|
Hey there, no worries at all and thanks again for the detailed input! I see where you're coming from, and I agree that supporting both plain hex and gradients through a single background parameter can be convenient. That said, I’m personally not a big fan of auto-appending the I also wanted to explain why I originally kept the parameters separate: All in all, I think your current direction works well, I just wanted to share the reasoning behind the original design choices in case it helps clarify things! |
Could you list some examples of edge cases? My current idea is this:
As of now, I don't see how that could really go wrong (assuming users will follow the README for syntax - if they don't, skill issue). Either way, your original code doesn't handle hashes, so the styling will break for anything after the gradient in the query params anyways. I wish things were as easy as they seem
This is a good point that I forgot about completely - however, there are ways to create a mask around elements to let the background naturally act as a border, see this demo. This is probably a bit complex though, so it's understandable if you don't want to tackle that Let me know your thoughts on all of this |
|
I currently know of two cases off the top of my head that would need a bit of special handling:
Could you clarify what you mean by that? Not sure I fully follow. Are you referring to how the query string is parsed or something else?
That sounds interesting. I’ll look into that approach. If I run into issues trying to get it working, I’ll reach out. |
|
Good examples, I see how it'll be harder than I thought Re: hashes - these are actually referred to as fragment URLs, but basically if there is a |
|
Ah, that’s what you meant. I didn’t know it was called that. |
|
Nice |
- add function to check if hex code - add handling for hex with/without # - support for all background option that are url encoded
|
Sorry I thought I pushed the code but i totally forgot it 😅 |
|
No comments since 7 months. |

This pull request enhances the
renderCardfunction insrc/utils/renderCard.tsxby introducing support for gradient backgrounds and improving background handling. The changes include updating logic for background assignment, adding support for all other background options alongside gradient options, and modifying the card's styling to use the new background property.Enhancements to background handling:
backgroundvariable inrenderCardto handle both solid color and gradient backgrounds.backgroundproperty instead ofbackgroundColor.#and usage of any other background css optionSee following Issue => #69