Page 1 of 1

change the background colour on first visit to the board

Posted: Wed May 08, 2019 9:20 pm
by TheButcher2
Hi guys would this be possible for the background colour of the board to be a different colour on the first visit each day when members log in, it is an idea I have been playing with for a while.

Peace


Dave

Re: change the background colour on first visit to the board

Posted: Thu May 09, 2019 1:56 am
by Hanakin
you would need to do this in JavaScript with cookies or with an ext via a new db property if you wish it to be truly unique. or just make it completely random and with vanilla js

Code: Select all

<script>

function getRandomColor() {
  var letters = '0123456789ABCDEF';
  var color = '#';
  for (var i = 0; i < 6; i++) {
    color += letters[Math.floor(Math.random() * 16)];
  }
  return color;
}


document.body.style.backgroundColor = getRandomColor();
</script>
have not tested but if you adding this to your head should work

Re: change the background colour on first visit to the board

Posted: Thu May 09, 2019 2:37 pm
by TheButcher2
Thanks for that, so I ad that code to the overall_header.tpl and place the background color codes on some other file?

Re: change the background colour on first visit to the board

Posted: Thu May 09, 2019 6:17 pm
by Hanakin
no just add this to your overall header between the head tags and it should do what you want. the code is creating random color codes for you

Re: change the background colour on first visit to the board

Posted: Thu May 09, 2019 6:33 pm
by TheButcher2
Ah thanks a lot, I'll try it,

Peace