Skip to content

Commit

Permalink
Update Energie.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Sputnik24 authored Oct 9, 2021
1 parent e833a8f commit 3d0bb9b
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion Energie.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,17 @@ function describeArc(x, y, radius, startAngle, endAngle){
].join(" ");

return d;
}
}

function getColor(percentage) {
var result;
if (percentage <= 50) {
var green = Math.round((percentage/50)*255);
result="rgb(255," + green + ",0)";
}
else if (percentage > 50 && percentage <= 100) {
var red = Math.round(510 -5.1*percentage);
result = "rgb(" + red + ",255,0)";
}
return result;
}

0 comments on commit 3d0bb9b

Please sign in to comment.