Read the statement by Michael Teeuw here.
Change background image based on time of day
-
@I_Am_Anthony Looks like it might work! You should call
updateBackground()
once before setting up the timer so that you’ll have a background at module startup, instead of having to wait for the timer to fire for the first time. -
@I_Am_Anthony
night_background
andday_background
will be undefined.you have to address them like
this.config.night_background
and you have to change your comparison operators.=>
defines an arrow function and doesn’t mean greaer or equal then like>=
would do. Less or equal would be ` -
Good catch on the missing
this.config.night_background
, thanks.I’m aware that it’s
>=
and<=
The markup really hates the less than or equal sign together (because HTML apparently), so I just flipped them for the purposes of markup. Just found that I can use the escape instead:<=
.Anyway, thanks to both of you @j.e.f.f and @strawberry-3-141 for the help. I’ve updated the code above to prevent repasting. I’ll get it into the mirror soon to test. If it works then I’ll package it and submit as a module.
-
I know this is an old topic but did you get this module finished? if do you have a git hub?
-
-
Not exactly what I am looking for. I tried to take @I_Am_Anthony code and tweak it to my needs but, no success. maybe you’ll review my code? :)
-
You can actually schedule all CSS entries in the module, including the background.
-
@Piranha1605 Cool! how would one do that? Still a noob.
-
@xTITUS-MAXIMUSx said in Change background image based on time of day:
Cool! how would one do that? Still a noob.
-
Install the module
-
Enter the time from when to when night is in the config.
-
Enter your background in the custom.css
.morning { background: blue; } .evening { background: black; }
-
-
@Piranha1605 Yeah dude I took a gander at your github and then set everything to my needs. I appreciate it!