Dark layout triggered based on visitor time

JiltedTongue
Level 1
Level 1
Joined: March 19th, 2012, 10:17 pm

September 13th, 2015, 6:39 pm #1

I've seen this over the years but never on a forum. Perhaps some of you have seen it in forum design.

Basically, the javascript code will detect the user/visitor's local time and use the appropriate stylesheet (light or dark). Not everyone cares but at night on my various computers and devices, I always dim the brightness. During the day, I'm not terribly fond of lighter text on dark backgrounds but at night, I really like it. I don't have perfect vision and it is easier on my eyes.

https://css-tricks.com/snippets/javascr ... me-of-day/

I want to try to do this. If members don't like it, it's easy enough to change themselves. I'd actually prefer another kind of implementation. I've seen some sites with a button that will trigger the change from day to night mode and vice-versa.

Some members use dark skins at night anyway but I think it's a good idea.

Your thoughts?
Quote
Like
Share

Aidan
Level 12
Level 12
Joined: August 20th, 2010, 3:13 pm

September 13th, 2015, 10:05 pm #2

I've seen one theme use a "button" for a light and dark variation of one theme. I also remember someone asking me to code a theme that would change by time of day and season. It's all very interesting and very possible. I'd love to see more themes of thos kind.
Quote
Like
Share

Joe
Level 15
Level 15
Joe
Level 15
Level 15
Joined: September 21st, 2008, 12:42 am

September 14th, 2015, 1:56 am #3

Would be very simple to implement this.

Have JS that looks at the board clock (`tr#foot_datetime a`), and if it's within a certain period, flip the theme. :geek:
Joe
Quote
Like
Share

Aidan
Level 12
Level 12
Joined: August 20th, 2010, 3:13 pm

September 14th, 2015, 4:04 am #4

Joe wrote:Would be very simple to implement this.

Have JS that looks at the board clock (`tr#foot_datetime a`), and if it's within a certain period, flip the theme. :geek:
Or better yet use the Date object in JS.
Quote
Like
Share

Matt
Level 6
Level 6
Joined: March 23rd, 2009, 8:04 pm

September 28th, 2015, 9:25 am #5

Honestly, it would depend on if you wanted it to change by board time, or by system time of the client pc... Personally, I'd side with Aiden and use the computers time so that the visitor doesn't get the daytime theme at night and vice versa.
Message Me:
Telegram - Twitter - Discord
Projects:
Forum Hosting
Quote
Like
Share


Matt
Level 6
Level 6
Joined: March 23rd, 2009, 8:04 pm

September 29th, 2015, 2:46 am #7

My bad... I typed without looking... at least I got all but one letter right!
Message Me:
Telegram - Twitter - Discord
Projects:
Forum Hosting
Quote
Like
Share