I've been using an additional ui-bar, which I created with the following code.
Javascript:
/* Create the Time UI Bar */
var $timeUiBar = $('<div id="time-ui-bar"></div>').insertAfter("#ui-bar");
var timeTray = $timeUiBar.append('<div id="time-ui-bar-tray"><button id="time-ui-bar-toggle" tabindex="0" title="Toggle the Time UI bar" aria-label="Toggle the Time UI bar" type="button"></button></div>');
var timeBody = $timeUiBar.append('<div id="time-ui-bar-body"></div>');
/* Automatically show the contents of the StoryTime passage in the time-ui-bar-body element. */
postrender["Display Time Sidebar Contents"] = function (content, taskName) {
setPageElement('time-ui-bar-body', 'StoryTime');
};
CSS:
#time-ui-bar {
background-color: yellow;
text-align: center;
position: fixed;
z-index: 60;
top: -2.5%;
right:-6%;;
width: 10em;
height:10em;
border-radius: 50%;
margin:0;
color:black;
border: .6em inset black;
}
#time-ui-bar-toggle{
display:none;}
body[data-tags~="no-time"] #time-ui-bar {
display: none;
}
(Plus I have a passage named StoryTime, for what I want to include there)
The idea was to change the background color, for example, depending on a variable (in this case, if the story was occuring at night or during the day).
I tried adapting your code, but I had some difficulty. I hope it's not too much to ask, if you could explain how to make it work. Thanks in advance :)