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

add option to map 24 hours to full color range #5

Open
der-On opened this issue Feb 12, 2017 · 9 comments
Open

add option to map 24 hours to full color range #5

der-On opened this issue Feb 12, 2017 · 9 comments

Comments

@der-On
Copy link

der-On commented Feb 12, 2017

It would be nice to have the full color range map to 24h of a day. This way color transitions would be more interesting and vivid.

@urtxintxa
Copy link
Owner

urtxintxa commented Feb 12, 2017

What do you mean exactly? The time is in 24h format. @der-On

@der-On
Copy link
Author

der-On commented Feb 12, 2017

I would like to have #00000 to map to 00:00:00 and #ffffff to 23:59:59 and #cccccc to 12:00:00 or something like that. So basically we would get the full color spectrum throughout the day.

@urtxintxa
Copy link
Owner

@der-On
I think this could be better:
00:00:00 -> #000000
00:00:30 -> #000081
00:00:59 -> #0000ff

12:00:00 -> #850000
12:10:15 -> #852b40

Hour is from 0 to 23, so convert that value to 0-255.
Same with minutes and seconds, from 0-59 to 0-255.

Then convert that values to hex, and get the colors. With this we could have plenty of colors.
What do you think?

@der-On
Copy link
Author

der-On commented Feb 13, 2017

@jajasuperman That sounds awesome! It should also bring smooth transitions even when minutes and hours change.

@cao-
Copy link

cao- commented Feb 13, 2017

There's another interesting way of transitioning between colours: we can do a random walk throughout the whole colour spectrum.

@urtxintxa
Copy link
Owner

@cao- Could you put an example?

@cao-
Copy link

cao- commented Feb 13, 2017

We can view our RGB colour space as a three dimensional cubic set of points. In fact, every point is a triplet of the form (r,g,b), where r,g and b are any number between 0 and 255.
Now simply imagine being inside this cube in a particular position. Every second you can move to one of your adjacent positions in a random way, with uniform probability distribution.

Example.
Suppose you start at the point (42,63,23), which corresponds to the hex colour #2a3f17. You have 26 adjacent points, namely (41,62,23), (41,63,23), (41,64,24), (42,63,22),... So you choose one of them at random, assigning to each of them probability 1/26. This way after a second you are on a new triplet, which means you are on a new colour.
Note: corners and side points have fewer than 26 adjacent points.

This method produces an always uniform but non-predictable transition between colours.

@urtxintxa
Copy link
Owner

@der-On @cao-
Nice idea. I will try to implement this two ideas.
Thanks guys ;)

@cao-
Copy link

cao- commented Feb 13, 2017

@jajasuperman Thank you for trying to implement our ideas!

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

3 participants