Fooidge/PleaseJS

Seed support

Closed this issue · 12 comments

It would be nice if the library supported colours generated based on a seed.

I can give this a go later this week if you're interested.

Do you mean a seed color? Or seeding the randomization?

Seeding the randomisation; this could be done by implementing something like a RC4 pseudo-random number generation (here is an implementation of it I've done for a different project).

What I have in mind is the ability to generate a set of colours based on selected parameters and a seed (e.g. a string), which would always return the same colour for the same string.

Can you give me an example of a compelling use for this?

For instance, you can generate a set of colours based on a nickname etc.. It's useful for situations when you want to have the same colour scheme for a seed (e.g. nickname) but you don't want to store the generated colours anywhere. All you need to do is read the nickname and retrieve the set of colours you have generated.

Another example, in procedurally generated games you might want to generate some colour schemes. The procedural generation could be seed based, and you always want to have the same output/result for the same seed.

Give it a whack, seems cool. My main concern is the size to benefit ratio of this change.

It will be just a few lines of modifications to the existing code plus the implementation of RC4, which is little over 40 lines and can be improved. I'll give it a go this weekend.

@Fooidge
This actually sounds pretty cool and would add a layer of sociability between users of PleaseJS.

For example, I could tweet:
"Check out 'Fudge'! It's absolutely delicious! #PleaseJS"

[Random passerby comment]

Except 'Fudge' might be magenta. But I am sort of geeking already at the thought of having a hashtag for this.

I see no harm in Fudge being magenta.
Just hope Fooidge isn't pink? ;)

👍 Amazing library, by the way. This is by far the best color generation module I've ever seen.

No. Was gonna look at it tomorrow.

Jordan Checkman

On Sep 20, 2014, at 4:01 PM, Taconut notifications@github.com wrote:

Has this enhancement been abandoned?


Reply to this email directly or view it on GitHub.

Added in 1482cad