Where f = a, b =.

 
Benedith: It was like 48.99999999999

Millison: I was basically doing backgroundColor = rgb48.99999999999,123.9999,123.999999999 and the long decimals made it not work for whatever reason

Pouncy: That sounds like a bug

Vanheel: Probably some restrictions put on by css

Kolling: Css cant handle decimals

Dorio: The reason it failed was because there was decimals

Cracraft: That doesn’t sound logical, dunno

Meachen: Can you post your function?

Dubinsky: Or perhaps a jsfiddle reproducing your issue?

Lambertson: Searchsidekick.net/setbg.js

Nowlen: I cant explain well sorry, but I’m generating color based on time of day. and at first it was doing 0/12 which is 0 but at 1 o clock it did 1/12 which is a decimal

Trethewey: Logan0405: Why do you need to divide by 12?

Money: Logan0405: Maybe you meant to perform some type of modulo operation using the number 12.

Vittetoe: Hmmm its just how i thought of doing it

Lagnese: In words, what do percentDay and percentNight represent?

Pelliccia: I have 2 colors the day color and the night color, and i blend them to set the background. if its closer to daytime i weight the day color more, closer to night i weight the night color more

Brzozowski: And add them. i hope that makes sense

Blas: Logan0405: Right. So decide on the behavior first and then work back to an algorithm that will produce that behavior using time of day. It’s not hard. But you have to start describing more specific behavior related to the colors and time.

Setter: I dont understand lol

Tipre: Logan0405: Right now, you haven’t even decided which colors you would want to see at for instance 3AM, 4AM, etc.

Gao: Whatcha mean? try it out searchsidekick.net

Peng: Logan0405: Oh. Sorry. From your description, it seemed as though you didn’t have specific behavior in mind yet, just a general “I want stuff to change”.

Zutell: Oh haha yeah its late for me. 2 am and back to back math cl***es tomorrow ;_;

Robusto: Im not good at conversation rn

Vanhorn: I just came in here cause i was stumped

Ansoategui: Well, i really do appreciate the help everyone. thanks

Easly: Logan0405: There are several ways to do it. If you want the colors to change per hour, just create a simple list / array that can be used to obtain the color based on the hour.

Teare: No special calculation. Just index into the array with the hour value.

Kraichely: True but i wanted it to be smooth and this is the most terse way i could think to do it

Lolley: Logan0405: Make the array larger, per minute, etc, if you want something more gradual,

Raoof: What you are doing is basically a zip of some sort zipg, a,b,c, d,e,f === ga,d, gb,e, gc,f

Tritt: SkyColorArray = “rgb10,20,30”, “rgb10,20,30”, “rgb10,20,30”, “rgb10,20,30”, “rgb10,20,30”, “rgb10,20,30”, . * 20

Litzenberger: You think thats more clear than a lil math?

Agemy: Logan0405: or just use your prior attempt, but truncate the fractional values.

Wendt: I think your approach looks ok, I’m not sure about the repetition though

Minutillo: What do you mean Harnly?

Hayhurst: Logan0405, this part http://dpaste.com/1QZW5RX

Macklem: True Xgc thats what i did. it took me a little while to realize css couldnt handle decimals

Tabor: Oh my god the machines have invaded #reactjs

Remington: Yeah i couldnt think of any way to get rid of that either falafel

Volkers: Suggestions would be very welcome

Camero: Always wanna learn somethin new

Swank: Logan0405, what I’m saying is that is basically a zip, zipf, r,g,b, r1,g1,b1 === fr,r1, fg,g1, fb,b1

Lifer: Where f = a, b = a*percentDay + b*percentNight