Addendum: Beeminder is actually inconsistent with itself about colors! When you load the goal page for https://www.beeminder.com/kenoubi/bike (for example) the HTML returned says <span class="doom blue" data-doom="2147306399">
, but then the Javascript doom counter immediately changes it to green. The behavior of the updateDoom
function is responsible for this (IMO better) behavior.
@dreev @bee Would you consider just changing the API for roadstatuscolor
to match this code (from the Beeminder Javascript that updates the doom counter):
function doomColorClass(doomStamp) {
if ($(".goal-panel").data("coasting")) {
return "green";
}
var doomDate = moment.unix(doomStamp + 1);
var now = moment();
var diff = doomDate.unix() - now.unix();
var days = Math.floor(diff/(24*60*60));
if (days < 1) {
return "red";
} else if (days < 2) {
return "orange";
} else if (days < 3) {
return "blue";
} else {
return "green";
}
}
I don’t think this would be very hard. The field appears to be undocumented, so it shouldn’t break anyone who’s only using the documented API.
That would fix it everywhere… in the meanwhile I have some hacky Javascript that works for the web, but I can’t do much about mobile. (Actually, I’m not even sure whether mobile uses roadstatuscolor
rather than recomputing the color itself… but it should use roadstatuscolor
)