--- a/2048.html Sun Sep 07 03:33:33 2014 +0300
+++ b/2048.html Sun Sep 07 14:16:26 2014 +0300
@@ -120,7 +120,10 @@
var ui = {};
ui.board = {};
ui.board.set = function(i, j, val) {
- boardDom.querySelectorAll("tr")[i].querySelectorAll("td")[j].innerHTML = val;
+ var dom = boardDom.querySelectorAll("tr")[i].querySelectorAll("td")[j];
+ dom.innerHTML = val;
+ var rgb = 'rgb(255,'+ (255-5*val-2*(val%2)) +','+ (255-10*val-5*((val-1)%2)) +')';
+ dom.style.backgroundColor = rgb;
}
ui.board.update = function(brd) {
for (var i = 0; i < 4; i++) {