Closed seiferteric closed 8 years ago
I did try some simple changes and it seems to work. See here: https://github.com/jfairbank/chroma/compare/master...seiferteric:eric-wip?expand=1
Not sure if there is more I need to do though for a pull request, or if there was a reason redefining the palette was disallowed in the first place.
Hi, @seiferteric.
Honestly, I can't remember why I decided to prevent redefining palettes besides that use case didn't make sense to me. I'm curious why you want to redefine a palette, but I'm not necessarily opposed to opening it up to redefinition.
Not sure if I am just using it incorrectly, but I just wanted to create a palette to get N unique colors (starting from a base color and rotate 360/N for each). N may increase, and I have no need for the old palette, so I just redefine the palette for the new N.
Sorry I'm lagging on responses. I've been out for conferences and other things.
I'm not fully opposed to this change, but I do like the "staticness" of setting it once. I'm curious how you're wanting to call it, and if maybe defining palettes and using them at the same time would work better?
Some new feature like:
'red'.paint.custom_palette do
spin 60
spin 180
end
However if you need to reuse it in other places, then that may not be as nice. Again, I'm open to removing the error entirely since there isn't a strong reason to really have it there.
That could work... Would just be more efficient to avoid redefining the palette each time it is needed. To further clarify what I am doing, I have a web application where each user needs a unique color. The only time the palette will change is when a new user is added, or one removed (fairly rare, since this is for a small business). So I (re)create a user_palette anytime a change in the users count happens. Using your suggested code above though, I could just store the color in the user model and not keep the palette around at all.
Cool. I'm on vacation through the rest of the week, but I can dive into adding a new feature like this when I get back home. I'm not ultimately opposed to dropping the error anyway, but this at least avoids bumping the major version.
@seiferteric Finally got the custom_palette
method implemented in the latest release. Try it out and let me know if you have any issues. Closing this issue. Thanks!
If I generate a custom palette, say "user_palette", then later, I want to regenerate it, I get:
Is there a way to support regenerating an already existing palette?